public uint Execute(PacketDistributed ipacket) { GC_REVIEW_RESULT packet = (GC_REVIEW_RESULT )ipacket; if (null == packet) { return((uint)PACKET_EXE.PACKET_EXE_ERROR); } //enter your logic //判断渠道类型 //只有appstore,测试版本,windows测试版本才会弹出评价 //其他渠道都关闭该功能 /* if ( PlatformHelper.ChannelType.IOS_APPSTORE == PlatformHelper.GetChannelType() || * PlatformHelper.ChannelType.IOS_TEST == PlatformHelper.GetChannelType() || * PlatformHelper.ChannelType.IOS_APPSTORE_TEST == PlatformHelper.GetChannelType() || * PlatformHelper.ChannelType.IOS_TY == PlatformHelper.GetChannelType() || * PlatformHelper.ChannelType.TEST == PlatformHelper.GetChannelType())*/ //当GetAppDetailUrl()返回“”时,表示该渠道未开启该功能。 //意思是说,如果某个渠道不想开启该功能,将AppDetailUrl属性设置为“”即可。 // 配置文件路径 //IOS,D:\Workspace\BuildTools\iOS\config_sdk.plist //Android,D:\Workspace\BuildTools\AndroidPlugins\Android_cyou\assets\config.properties string sAppDetailUrl = PlatformHelper.GetAppDetailUrl(); if ("" != sAppDetailUrl && null != sAppDetailUrl) { switch (PlayerPreferenceData.ReviewRefuseType) { case (int)Games.GlobeDefine.GameDefine_Globe.REVIEW_TYPE.DO_NOTHING: case (int)Games.GlobeDefine.GameDefine_Globe.REVIEW_TYPE.WAIT_FOR_A_MOMENT: case (int)Games.GlobeDefine.GameDefine_Globe.REVIEW_TYPE.REFUSE_WITHOUT_RESON: case (int)Games.GlobeDefine.GameDefine_Globe.REVIEW_TYPE.RT_INVALID: case (int)Games.GlobeDefine.GameDefine_Globe.REVIEW_TYPE.INTOLERABILITY: { GameManager.gameManager.PlayerDataPool.ReviewResult = packet.Result; GameManager.gameManager.PlayerDataPool.ReviewRewardEnable = packet.OpenReward; } break; case (int)Games.GlobeDefine.GameDefine_Globe.REVIEW_TYPE.WITH_PLEASURE: { GameManager.gameManager.PlayerDataPool.ReviewResult = (int)Games.GlobeDefine.GameDefine_Globe.REVIEW_TYPE.WITH_PLEASURE; GameManager.gameManager.PlayerDataPool.ReviewRewardEnable = packet.OpenReward; } break; } } else { GameManager.gameManager.PlayerDataPool.ReviewResult = (int)Games.GlobeDefine.GameDefine_Globe.REVIEW_TYPE.RT_INVALID; GameManager.gameManager.PlayerDataPool.ReviewRewardEnable = 0; } return((uint)PACKET_EXE.PACKET_EXE_CONTINUE); }
//现在去评价按钮 void ReviewNow() { //先把客户端的状态给改了 PlayerPreferenceData.ReviewRefuseType = (int)Games.GlobeDefine.GameDefine_Globe.REVIEW_TYPE.WITH_PLEASURE; GameManager.gameManager.PlayerDataPool.ReviewResult = (int)Games.GlobeDefine.GameDefine_Globe.REVIEW_TYPE.WITH_PLEASURE; //notice gameserver CG_REVIEW_RESULT pPacket = (CG_REVIEW_RESULT)PacketDistributed.CreatePacket(MessageID.PACKET_CG_REVIEW_RESULT); if (null != pPacket) { pPacket.SetResult(GameManager.gameManager.PlayerDataPool.ReviewResult);//It is the most effective way that encourages us programming. pPacket.SendPacket(); } Application.OpenURL(PlatformHelper.GetAppDetailUrl()); //隐藏tab CloseWindow(); HideReviewTab(); }
//实际事件处理接口 void _ProcessEvent(GameEvent _event) { //首先弹出这个Events m_DelayEventQueue.Remove(_event); switch (_event.EventID) { case Games.GlobeDefine.GameDefine_Globe.EVENT_DEFINE.EVENT_ENTERGAME: { //举个例子,之后处理函数过多的时候可以考虑封装 int nLevel = _event.GetIntParam(0); LoadingWindow.LoadScene((Games.GlobeDefine.GameDefine_Globe.SCENE_DEFINE)nLevel); } break; case Games.GlobeDefine.GameDefine_Globe.EVENT_DEFINE.EVENT_MISSION_COLLECTITEM: { //int nMissionID = _event.GetIntParam(0); GameManager.gameManager.MissionManager.MissionCollectItem(); } break; case Games.GlobeDefine.GameDefine_Globe.EVENT_DEFINE.EVENT_CHANGESCENE: { int nLevel = _event.GetIntParam(0); if (Singleton <ObjManager> .Instance.MainPlayer != null) { Singleton <ObjManager> .Instance.MainPlayer.OnPlayerLeaveScene(); } LoadingWindow.LoadScene((Games.GlobeDefine.GameDefine_Globe.SCENE_DEFINE)nLevel); //处理消息包标记位 //NetWorkLogic.GetMe().CanProcessPacket = false; //Application.LoadLevel(nLevel); } break; case Games.GlobeDefine.GameDefine_Globe.EVENT_DEFINE.EVENT_QINGGONG: { // if (Singleton<ObjManager>.Instance.MainPlayer != null) // { // Singleton<ObjManager>.Instance.MainPlayer.BeginQingGong(_event); // } int nServerID = _event.GetIntParam(2); Obj obj = Singleton <ObjManager> .Instance.FindObjInScene(nServerID); if (obj) { if (obj.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_OTHER_PLAYER || obj.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER) { Obj_OtherPlayer OtherPlayer = obj as Obj_OtherPlayer; if (OtherPlayer) { OtherPlayer.BeginQingGong(_event); } } } } break; case Games.GlobeDefine.GameDefine_Globe.EVENT_DEFINE.EVENT_COLLECTITEM_RESEED: { int nSceneID = _event.GetIntParam(0); int nSceneIndex = _event.GetIntParam(1); int nItemIndex = _event.GetIntParam(2); if (Singleton <CollectItem> .GetInstance() != null) { Singleton <CollectItem> .GetInstance().ReSeedItems(nSceneID, nSceneIndex, nItemIndex); } } break; case GameDefine_Globe.EVENT_DEFINE.EVENT_TOUCH_UI: { RequestReviewWindow.OnTouchUI(); } break; case GameDefine_Globe.EVENT_DEFINE.EVENT_TOUCH_OBJECT: RequestReviewWindow.OnTouchObject(); break; case GameDefine_Globe.EVENT_DEFINE.EVENT_TOUCH_SCENE: RequestReviewWindow.OnTouchScene(); break; case Games.GlobeDefine.GameDefine_Globe.EVENT_DEFINE.EVENT_CALL_NAVIGATOR: Application.OpenURL(PlatformHelper.GetAppDetailUrl()); break; default: break; } }