日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

cocos2dx实现单机版三国杀(二)

發布時間:2023/12/20 编程问答 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 cocos2dx实现单机版三国杀(二) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

接上續,東西還沒有做完 所以代碼免不了改動

之前的頭文件現在又改了不少,因為架構也改變了現在主要類就是GameScene、GameUI、PlayInfo、Poker這四個類 ?前面想的GameLoop 已經被棄

目前除了身份、武將等相關的高級功能還沒添加,基本功能只剩下 出牌策略沒做了。

貼一下GameUI新的頭文件

#pragma once
/*
主游戲界面UI

*/

#include "cocos2d.h"
#include "ui/CocosGUI.h"


USING_NS_CC;
class PlayInfo;
class Poker;
class GameUI:public cocos2d::Layer
{
//friend class GameScene;
public:
bool init();

virtual void onEnter();
virtual void onExit();

void menuReOpen(Ref*pSender);//重開
void menuExit(Ref*pSender);//退出游戲
void menuaddpoker(Ref*pSender);
void menuusepoker(Ref*pSender);
void menugiveuppoker(Ref*pSender);

void update(float delta);
/* 玩家摸牌 顯示 */
void addPoker( int ,int);
/* 玩家使用牌(包括回合內外) 顯示 */
void usePoker(int num=1);
/* 玩家棄牌 顯示 */
void giveupPoker( );
/* 電腦玩家棄牌 顯示*/
void giveupPoke_Robot(int );
void fun1(Ref*);
/*棄牌堆的更新*/
void Updategiveupheap();

CREATE_FUNC(GameUI);

//初始化角色信息
void initRoleInfo(PlayInfo* player);
//更新角色信息(顯示)
void UpdateRoleInfo(PlayInfo*player);

//初始化對手信息
void initFoeInfo(PlayInfo* player);
//更新對手信息(顯示)
void UpdatFoeInfo(PlayInfo*player);

Label*CurrenState;
bool isAddPoker;
void CountDown(float dt=5.0f);//倒計時函數實現延時功能
void setTimeBarwithtime(float );
bool isCountDown;//是否在讀條 即調用了CountDown
bool isEndUsePokeState;//是否結束出牌階段

void SwapTimeBar();//交換當前回合的時間讀條指針,令當前回合進行讀條的Loadingbar 指針指向play的時間讀條指針

void UpdateShowPokerSlot(PlayInfo*);//更新手牌槽,外部調用
void DrawShowPokerSlot();//繪制手牌槽的牌
void addgiveupheap(Poker*);//添加牌到棄牌堆
private:
std::vector<Poker*>showpokerslot;//玩家需要顯示的手牌槽
std::vector<int>showIntslot;
std::vector<Poker*>giveupPokerHeap;//棄牌堆
Sprite*bg;//背景圖片
Sprite*equipment;//裝備欄圖片
Sprite*pokerSlot;//手牌槽背景圖片
Sprite*rolePicInfo;//角色ui圖片信息
//Vector<Sprite*>roleHealthInfo;

Sprite*foeInfoShow;

ui::LoadingBar* timebar;
ui::LoadingBar* timebarRobot;

Label* timelabel;

Label*_showOurPokerNums;
Label*_showFoePokerNums;


};

?------------------------------

雖然還有很多坑,但是基本流程是完成了

暫時放下來,有時間再填坑

https://github.com/huzhongyidihao/sanguosha

?

轉載于:https://www.cnblogs.com/yuedongdeguangzi/p/8668870.html

總結

以上是生活随笔為你收集整理的cocos2dx实现单机版三国杀(二)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。