Example #1
0
    //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);
    }
Example #2
0
    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);
        }
    }