void OnClickBtn(GameObject go) { tagChestInfo pChestInfo = PlayerRole.Instance.ChestManager.GetNowActionChest(); if (pChestInfo != null && pChestInfo.ChestOnlyID == m_byChestOnlyID)//是否过期 { for (byte i = 0; i < m_BtnInfo.Length; ++i) { if (m_BtnInfo[i].m_goBtn == go && !m_BtnInfo[i].m_IsChecked) { if (m_BtnInfo[i].m_goDiamond.activeSelf) { uint uCost = System.Convert.ToUInt32(m_BtnInfo[i].m_labeldiamond.text); if (uCost != 0 && uCost > PlayerRole.Instance.RoleInfo.RoleMe.GetCurrency()) { GlobalHallUIMgr.Instance.ShowPayWnd(PayType.Diamond); return; } } PlayerRole.Instance.ChestManager.GetChestRewardByIndex(i); return; } } if (go == m_goCancel) { PlayerRole.Instance.ChestManager.CloseNowChest(); } } }
public tagChestActionEvent(tagChestInfo ChestObj, Byte ChestSum, bool IsReset) : base(MsgEventType.MET_Chest_Action) { this.ChestSum = ChestSum; ActionChest = ChestObj; this.IsReset = IsReset; }
bool HandleChestEnd(NetCmdBase obj) { LC_Cmd_ChestEnd ncb = (LC_Cmd_ChestEnd)obj; if (ActionChestInfo == null) { tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_Chest_CloseChest_Failed_2); MsgEventHandle.HandleMsg(pUOM); return(false); } if (ActionChestInfo.ChestOnlyID != ncb.ChestOnlyID) { tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_Chest_CloseChest_Failed_2); MsgEventHandle.HandleMsg(pUOM); return(false); } ActionChestInfo = null; tagChestEndEvent pEvent = new tagChestEndEvent(); MsgEventHandle.HandleMsg(pEvent); tagUserOperationEvent pUOM2 = new tagUserOperationEvent(UserOperateMessage.UOM_Chest_CloseChest_Sucess); MsgEventHandle.HandleMsg(pUOM2); return(true); }
//bool HandleAddChest(NetCmdBase obj) //{ // //客户端添加一个新的宝箱 // LC_Cmd_AddChest ncb = (LC_Cmd_AddChest)obj; // if (!FishConfig.Instance.m_ChestInfo.ChestMap.ContainsKey(ncb.ChestTypeID)) // return false; // tagChestInfo pChest = new tagChestInfo(); // pChest.ChestTypeID = ncb.ChestTypeID; // pChest.ActionTime = 0; // pChest.OpenSum = 0; // pChest.ChestOnlyID = ncb.ChestOnlyID; // ChestList.Add(pChest); // return true; //} bool HandleActionChest(NetCmdBase obj) { LC_Cmd_ActionChest ncb = (LC_Cmd_ActionChest)obj; if (ActionChestInfo != null) { return(false); } if (!FishConfig.Instance.m_ChestInfo.ChestMap.ContainsKey(ncb.ChestTypeID)) { return(false); } ActionChestInfo = new tagChestInfo(); ActionChestInfo.ChestOnlyID = ncb.ChestOnlyID; ActionChestInfo.ChestTypeID = ncb.ChestTypeID; ActionChestInfo.OpenSum = ncb.OpenSum; ActionChestInfo.ActionTime = Utility.GetTickCount() - Convert.ToUInt32(FishConfig.Instance.m_ChestInfo.ChestMap[ncb.ChestTypeID].ExisteSec * 1000 - ncb.EndSec); //ActionChestInfo.ActionOpemStates = ncb.ActionOpenStates; //ActionChestInfo.ActionRewardStates = ncb.ActionRewardStates; if (ncb.ChestArray != null && ncb.ChestArray.Length > 0) { for (int i = 0; i < ncb.ChestArray.Length; ++i) { ActionChestInfo.ChestArray.Add(ncb.ChestArray[i]); } } tagChestActionEvent pEvent = new tagChestActionEvent(ActionChestInfo, ncb.ChestSum, ncb.IsReset); MsgEventHandle.HandleMsg(pEvent); return(true); }
private bool SendCloseActionChest()//发送关闭当前宝箱的操作 { if (ActionChestInfo == null) { tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_Chest_CloseChest_Failed_1); MsgEventHandle.HandleMsg(pUOM); return(false); } tagChestInfo pActionChest = ActionChestInfo; if (pActionChest.ActionTime == 0 || pActionChest.ChestTypeID == 0) { tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_Chest_CloseChest_Failed_1); MsgEventHandle.HandleMsg(pUOM); return(false); } if (!FishConfig.Instance.m_ChestInfo.ChestMap.ContainsKey(pActionChest.ChestTypeID)) { tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_Chest_CloseChest_Failed_1); MsgEventHandle.HandleMsg(pUOM); return(false); } //关闭当前激活的宝箱 CL_Cmd_CloseChest ncb = new CL_Cmd_CloseChest(); ncb.SetCmdType(NetCmdType.CMD_CL_CloseChest); ncb.ChestOnlyID = pActionChest.ChestOnlyID; NetServices.Instance.Send <CL_Cmd_CloseChest>(ncb); return(true); }
private bool SendGetChestReward(Byte ChestIndex) { //获取宝箱的奖励 当前激活的宝箱 //1.判断宝箱数量 if (ActionChestInfo == null) { tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_Chest_OpenChest_Failed_1); MsgEventHandle.HandleMsg(pUOM); return(false); } tagChestInfo pActionChest = ActionChestInfo; if (pActionChest.ActionTime == 0 || pActionChest.ChestTypeID == 0) { tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_Chest_OpenChest_Failed_1); MsgEventHandle.HandleMsg(pUOM); return(false); } if (!IsCanOpenChestIndex(ChestIndex)) { tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_Chest_OpenChest_Failed_2); MsgEventHandle.HandleMsg(pUOM); return(false); } if (!FishConfig.Instance.m_ChestInfo.ChestMap.ContainsKey(pActionChest.ChestTypeID)) { tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_Chest_OpenChest_Failed_3); MsgEventHandle.HandleMsg(pUOM); return(false); } //当前集合的宝箱存在 判断宝箱的打开次数 if (pActionChest.OpenSum >= FishConfig.Instance.m_ChestInfo.ChestMap[pActionChest.ChestTypeID].CostInfo.MaxCostNum) { tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_Chest_OpenChest_Failed_4); MsgEventHandle.HandleMsg(pUOM); return(false); } if (!FishConfig.Instance.m_ChestInfo.ChestMap[pActionChest.ChestTypeID].CostInfo.CostMap.ContainsKey((Byte)(pActionChest.OpenSum + 1))) { tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_Chest_OpenChest_Failed_4); MsgEventHandle.HandleMsg(pUOM); return(false); } if (PlayerRole.Instance.RoleInfo.RoleMe.GetCurrency() < FishConfig.Instance.m_ChestInfo.ChestMap[pActionChest.ChestTypeID].CostInfo.CostMap[(Byte)(pActionChest.OpenSum + 1)]) { tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_Chest_OpenChest_Failed_5); MsgEventHandle.HandleMsg(pUOM); return(false); } CL_Cmd_GetChestReward ncb = new CL_Cmd_GetChestReward(); ncb.SetCmdType(NetCmdType.CMD_CL_GetChestReward); ncb.ChestIndex = ChestIndex;//无实际作用 ncb.ChestOnlyID = pActionChest.ChestOnlyID; NetServices.Instance.Send <CL_Cmd_GetChestReward>(ncb); return(true); }
bool HandleResetChest(NetCmdBase obj) { LC_Cmd_ResetChest ncb = (LC_Cmd_ResetChest)obj; ActionChestInfo = null; tagChestResetEvent pEvent = new tagChestResetEvent(); MsgEventHandle.HandleMsg(pEvent); return(true); }
public void ShowChestWindow(tagChestActionEvent pChest) { tagChestInfo pChestInfo = PlayerRole.Instance.ChestManager.GetNowActionChest(); if (pChestInfo == null) { return; } if (pChest.IsReset) { OnReset(); m_byStoreBoxs = pChest.ChestSum; ShowBg(); Transform tfTemp = m_Obj_Chest.transform.GetChild(0).GetChild(2); tfTemp.GetChild(0).GetComponent <Animator>().Play(Animator.StringToHash("ChestWindBg_Anim"), 0, 1.0f); tfTemp.GetChild(1).GetComponent <Animator>().Play(Animator.StringToHash("DownSprite_Anim"), 0, 1.0f); tfTemp.GetChild(2).GetComponent <Animator>().Play(Animator.StringToHash("UpperSprite_Anim"), 0, 1.0f); tfTemp.GetChild(3).GetChild(0).GetComponent <Animator>().Play(Animator.StringToHash("Dummy(1)_Anim"), 0, 1.0f); tfTemp.GetChild(4).GetChild(0).GetComponent <Animator>().Play(Animator.StringToHash("Item2_Anim"), 0, 1.0f); tfTemp.GetChild(5).GetChild(0).GetComponent <Animator>().Play(Animator.StringToHash("Item3_Anim"), 0, 1.0f); tfTemp.GetChild(6).GetChild(0).GetComponent <Animator>().Play(Animator.StringToHash("Item4_Anim"), 0, 1.0f); tfTemp.GetChild(7).GetChild(0).GetComponent <Animator>().Play(Animator.StringToHash("FreeAlpha_Anim"), 0, 1.0f); tfTemp.GetChild(8).GetChild(0).GetComponent <Animator>().Play(Animator.StringToHash("FreeAlpha_Anim"), 0, 1.0f); tfTemp.GetChild(9).GetChild(0).GetComponent <Animator>().Play(Animator.StringToHash("FreeAlpha_Anim"), 0, 1.0f); tfTemp.GetChild(10).GetChild(0).GetComponent <Animator>().Play(Animator.StringToHash("FreeAlpha_Anim"), 0, 1.0f); //显示未开的 DoShow(pChest.ActionChest.ChestTypeID, pChest.ActionChest.ActionTime, pChest.ActionChest.ChestOnlyID, true); //开过的 if (pChest.ActionChest.ChestArray != null) { for (byte i = 0; i < pChest.ActionChest.ChestArray.Count; i++) { ChestOnceStates pOpen = pChest.ActionChest.ChestArray[i]; OnOpenBox(true, pOpen.Index, pOpen.RewardID, pOpen.RewardOnlyID, false); } } } else { Message pMessage = new Message(); pMessage.m_msgtype = MsgType.SHOW; pMessage.m_byparam1 = pChestInfo.ChestTypeID; pMessage.m_byparam2 = pChestInfo.ActionTime;// - Utility.GetTickCount())/1000); pMessage.m_byparam3 = pChestInfo.ChestOnlyID; m_MessageList.Add(pMessage); } }
bool HandleGetChestReward(NetCmdBase obj) { LC_Cmd_GetChestReward ncb = (LC_Cmd_GetChestReward)obj; tagUserOperationEvent pUOM = new tagUserOperationEvent((ncb.Result ? UserOperateMessage.UOM_Chest_OpenChest_Sucess : UserOperateMessage.UOM_Chest_OpenChest_Failed_6)); MsgEventHandle.HandleMsg(pUOM); if (ActionChestInfo == null) { return(false); } tagChestInfo pChest = ActionChestInfo; if (pChest.ChestOnlyID != ncb.ChestOnlyID) { return(false); } if (!FishConfig.Instance.m_ChestInfo.ChestMap[pChest.ChestTypeID].RewardInfo.RewardMap.ContainsKey(ncb.ChestStates.RewardID)) { return(false); } if (!FishConfig.Instance.m_ChestInfo.ChestMap[pChest.ChestTypeID].RewardInfo.RewardMap[ncb.ChestStates.RewardID].RewardLog.ContainsKey(ncb.ChestStates.RewardOnlyID)) { return(false); } tagChestsRewardOnce pOnce = FishConfig.Instance.m_ChestInfo.ChestMap[pChest.ChestTypeID].RewardInfo.RewardMap[ncb.ChestStates.RewardID].RewardLog[ncb.ChestStates.RewardOnlyID]; if (ncb.Result) { pChest.OpenSum += 1; ChestOnceStates pChestOnce = new ChestOnceStates(); pChestOnce = ncb.ChestStates; tagChestRewardEvent pEvent = new tagChestRewardEvent(pChestOnce); MsgEventHandle.HandleMsg(pEvent); } return(true); }
public void OnClear() { ActionChestInfo = null; }