183 lines
4.2 KiB
C++
183 lines
4.2 KiB
C++
#pragma once
|
|
#include "cocos2d.h"
|
|
#include "cocostudio/CocoStudio.h"
|
|
#include "ui/CocosGUI.h"
|
|
|
|
#include "PrivateMission.h"
|
|
#include "IndividualMission.h"
|
|
#include "UserInGameServer.h"
|
|
#include "MissionWeiXin.h"
|
|
#include "LoginMission.h"
|
|
#include "SystemNotice.h"
|
|
#include "TipNode.h"
|
|
#include "JoinScene.h"
|
|
#include "CreateScene.h"
|
|
#include "GameUnionScene.h"
|
|
|
|
USING_NS_CC;
|
|
using namespace cocos2d::ui;
|
|
|
|
// 点击类型;
|
|
enum BT_CLICK_TYPE
|
|
{
|
|
BT_CLICK_NULL = 0, //初始值;
|
|
BT_CLICK_UNION, //工会;
|
|
BT_CLICK_CREATE, //创建;
|
|
BT_CLICK_JOIN, //加入;
|
|
};
|
|
|
|
class MainScene : public Scene
|
|
, public IIndividualMissionSink
|
|
, public IUserInGameServerSink
|
|
, public IWeiXinMissionSink
|
|
, public ILoginMissionSink
|
|
, public IPrivateMissionSink
|
|
{
|
|
|
|
public:
|
|
MainScene();
|
|
~MainScene();
|
|
|
|
public:
|
|
CREATE_FUNC(MainScene);
|
|
|
|
virtual bool init();
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual void onEnterTransitionDidFinish();
|
|
|
|
virtual void onExit();
|
|
|
|
void appWillEnterForeground();
|
|
|
|
// 初始化系统信息
|
|
void InitSystemInfo();
|
|
|
|
void updateServerInfo();
|
|
|
|
// 获取地理位置
|
|
//void getPlacedWithIP(const char* pStr);
|
|
|
|
public:
|
|
virtual void onGPNoticeResult(tagGameMatch& pGameMatchInfo,bool bSucess,const char* pStr );
|
|
|
|
virtual void onGPAccountInfo(CMD_GP_UserAccountInfo* pAccountInfo);
|
|
|
|
virtual void onUserInGameServerID(CMD_GP_InGameSeverID* pNetInfo);
|
|
|
|
virtual void onUserInUnion(CMD_GP_InUnion* pNetInfo);
|
|
|
|
virtual void onUnionAndGameInfo(tagUnionAndGameList *pUnionAndGameList);
|
|
|
|
virtual void onUnionRoomInfo(tagRoomItemList *pRoomItemList);
|
|
|
|
virtual void onAutoRoomInfo(tagAutoRoomItemList *pRoomItemList);
|
|
|
|
virtual void StartGameScene(CGameServerItem* pServer);
|
|
|
|
virtual void CreateAutoRoomInfoResulte(CMD_GR_AutoResulte* pAutoResulte);
|
|
|
|
void checkInGameServer();
|
|
|
|
void upPlayerInfo();
|
|
|
|
void onEventBtnClick(BT_CLICK_TYPE btnClickType);
|
|
|
|
// 创建房间
|
|
void onEventCreatePrivateRoom(EventCustom* event);
|
|
// 加入房间
|
|
void onEventJoinPrivateRoom(EventCustom* event);
|
|
// 更新房卡
|
|
void onEventUpdateUserInsure(EventCustom* event);
|
|
// 微信分享朋友圈成功
|
|
void WXShardFriendsSuccess(EventCustom* event);
|
|
// 分享结果;
|
|
virtual void onWXShardReward(CMD_GP_WXShareReward* pReward);
|
|
|
|
//按键处理
|
|
void onKeyReleased(EventKeyboard::KeyCode keyCode, Event * pEvent);
|
|
|
|
// 显示头像
|
|
void ShowHead();
|
|
|
|
// 私人场;
|
|
private:
|
|
void joinPrivateRoom(uint32 dwRoomNum);
|
|
void RequsetHttpInfo();
|
|
|
|
//请求版本信息结果
|
|
void ResponseResult(rapidjson::Document* pDoc);
|
|
|
|
//请求玩家信息;
|
|
void ResponseUserInfoResult(rapidjson::Document* pDoc);
|
|
|
|
// 公会房间;
|
|
private:
|
|
// 初始化公会界面;
|
|
void initUnionRoom();
|
|
|
|
// 显示工会房间;
|
|
void showUnionRoomList(tagRoomItemList *pRoomItemList);
|
|
|
|
// 显示工会列表;
|
|
void ShowUnionList(tagUnionAndGameList* pUnionAndGameList);
|
|
|
|
// 启动定时刷新工会信息;
|
|
void startUnionRoomTime();
|
|
|
|
// 请求公会房间;
|
|
void RequsetUnionRoomList(bool isLoading = true);
|
|
|
|
// 输入工会ID
|
|
void onEventInpuUnionID(EventCustom* event);
|
|
|
|
// 获取房间列表;
|
|
void onEventGetRoomList(EventCustom* event);
|
|
|
|
// 获取自动开房信息;
|
|
void onEventGetAutoRoomList(EventCustom* event);
|
|
|
|
// 创建代开信息;
|
|
void onEventCreateAutoRoomInfo(EventCustom* event);
|
|
|
|
// 删除代开信息;
|
|
void onEventDeleteAutoRoomInfo(EventCustom* event);
|
|
|
|
// 获取游戏规则;
|
|
std::string getGameRule(uint16 wKindID, uint32 dwGameRule);
|
|
|
|
protected:
|
|
Node* m_rootPanel; //根节点;
|
|
PrivateMission m_kPrivateMission;
|
|
UserInGameServer m_kUserInGameServer;
|
|
IndividualMission m_IndivMission;
|
|
|
|
bool m_IsStartGame; // 正在启动游戏
|
|
Button* m_CreateItem; // 服务器节点
|
|
BT_CLICK_TYPE m_btnClickType; //按钮点击;
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
TipNode* m_SetNode;
|
|
JoinScene* m_JoinNode;
|
|
CreateScene* m_CreateNode;
|
|
GameUnionScene* m_GameUnionNode;
|
|
|
|
ImageView* m_SystemInfo; // 系统公告
|
|
SystemNotice* m_PlatformNotic;
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
Layout* m_PanelRoom;
|
|
ScrollView* m_RoomList;
|
|
ScrollView* m_UnionList;
|
|
Button* m_btnRefresh;
|
|
Button* m_btnRoomItem0;
|
|
Button* m_btnRoomItem1;
|
|
Button* m_btnUnionItem;
|
|
Button* m_btnBackUnion;
|
|
Button* m_txtSelectUnion;
|
|
//Text* m_txtBackUnion;
|
|
uint32 m_dwSelectUnionCode;
|
|
bool m_isRefreshing;
|
|
int m_nRefreshErr;
|
|
}; |