public void SyncData(Variant data)
        {
            List <Variant> dragonDataList = data["tulong_lvl_ary"]._arr;

            for (int i = 0; i < dragonDataList.Count; i++)
            {
                Variant    dragondata = dragonDataList[i];
                string     dragonName = dicDragonName[i];
                DragonData dragonData = new DragonData();
                dragonData.isUnlcoked = dragondata["zhaohuan"];
                dragonData.isDead     = dragondata["death"]._bool;
                dragonData.proc       = dragondata["jindu"]._uint;
                dragonData.isCreated  = dragondata["create_tm"]._bool;
                dragonData.isOpened   = dragondata["open"]._bool;
                dragonData.dragonId   = dragondata["lvl_id"]._uint;
                if (dicDragonData.ContainsKey(dragonName))
                {
                    if (!dicDragonData[dragonName].isUnlcoked && dicDragonData[dragonName].isUnlcoked ^ dragonData.isUnlcoked)
                    {
                        flytxt.instance.fly(ContMgr.getCont("slaydragon_over"));
                    }
                }
                //flytxt.instance.fly("已解除封印");
                dicDragonData[dragonName] = dragonData;
            }
        }
示例#2
0
        public void SyncData(Variant data)
        {
            List <Variant> arr = data["tulong_lvl_ary"]._arr;

            for (int i = 0; i < arr.Count; i++)
            {
                Variant    variant    = arr[i];
                string     key        = this.dicDragonName[i];
                DragonData dragonData = new DragonData();
                dragonData.isUnlcoked = variant["zhaohuan"];
                dragonData.isDead     = variant["death"]._bool;
                dragonData.proc       = variant["jindu"]._uint;
                dragonData.isCreated  = variant["create_tm"]._bool;
                dragonData.isOpened   = variant["open"]._bool;
                dragonData.dragonId   = variant["lvl_id"]._uint;
                bool flag = this.dicDragonData.ContainsKey(key);
                if (flag)
                {
                    bool flag2 = !this.dicDragonData[key].isUnlcoked && (this.dicDragonData[key].isUnlcoked ^ dragonData.isUnlcoked);
                    if (flag2)
                    {
                        flytxt.instance.fly("已解除封印", 0, default(Color), null);
                    }
                }
                this.dicDragonData[key] = dragonData;
            }
        }
        private void RunTimer()
        {
            DragonData unlockedDrgnData = A3_SlayDragonModel.getInstance()?.GetUnlockedDragonData();

            if (goTimer.activeSelf && unlockedDrgnData != null && unlockedDrgnData.endTimeStamp != 0)
            {
                long currentTime = muNetCleint.instance.CurServerTimeStamp;
                long span        = unlockedDrgnData.endTimeStamp - currentTime;
                if (span > 0)
                {
                    txtTimer.text = string.Format("{0:D2}:{1:D2}", span % 3600 / 60, span % 60);
                }
                else
                {
                    txtTimer.text = "00:00";
                }
            }
        }
        private void OnGive(GameObject go)
        {
            uint       unlockedDragonId = 0;
            DragonData curDrgnData      = A3_SlayDragonModel.getInstance().dicDragonData[currentSelectedDragonName];

            if (0 != (unlockedDragonId = A3_SlayDragonModel.getInstance().GetUnlockedDragonId()) && unlockedDragonId == curDrgnData.dragonId)
            {
                uint itemId = A3_SlayDragonModel.getInstance().GetDragonKeyId();
                if (0 != itemId)
                {
                    if (0 < a3_BagModel.getInstance().getItemNumByTpid(itemId))
                    {
                        if (curDrgnData.proc < A3_SlayDragonModel.getInstance().GetCost())
                        {
                            A3_SlayDragonProxy.getInstance().SendGive();
                        }
                        else
                        {
                            flytxt.instance.fly(ContMgr.getCont("A3_SlayDragon_can"));
                        }
                    }
                    else
                    {
                        ArrayList data = new ArrayList();
                        data.Add(a3_BagModel.getInstance().getItemDataById(itemId));
                        InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_ITEMLACK, data);
                    }
                }
            }
            else
            {
                if (A3_LegionModel.getInstance().myLegion.clanc < 3)
                {
                    flytxt.instance.fly(ContMgr.getCont("A3_SlayDragon_jf"));
                }
                else
                {
                    flytxt.instance.fly(ContMgr.getCont("A3_SlayDragon_please"));
                }
            }
        }
 private void OnUnlockDragon(GameObject go)
 {
     if (A3_LegionModel.getInstance().myLegion.clanc >= 3)
     {
         if (currentSelectedDragonName != null)
         {
             DragonData dragonData = A3_SlayDragonModel.getInstance().dicDragonData[currentSelectedDragonName];
             if (!dragonData.isUnlcoked && 0 == A3_SlayDragonModel.getInstance().GetUnlockedDragonId())
             {
                 A3_SlayDragonProxy.getInstance().SendUnlock(dragonData.dragonId);
             }
             else
             {
                 flytxt.instance.fly(ContMgr.getCont("A3_SlayDragon_nomany"));
             }
         }
     }
     else
     {
         flytxt.instance.fly(ContMgr.getCont("A3_SlayDragon_kustllx"));
     }
 }
        private void RefreshDragonInfo(string dragonName)
        {
            DragonData dragonData = A3_SlayDragonModel.getInstance().dicDragonData[dragonName];
            int        cost       = A3_SlayDragonModel.getInstance().GetCost();
            uint       dragonId   = dragonData.dragonId;
            uint       proc       = dragonData.proc;
            bool       isUnlocked = dragonData.isUnlcoked,
                       isOpened   = dragonData.isOpened,
                       isDead     = dragonData.isDead,
                       isCreated  = dragonData.isCreated && !isDead;

            if (isCreated || isDead)
            {
                goTimer.SetActive(isCreated);
                rootDragonOpt.FindChild("proc_unlock").gameObject.SetActive(false);
            }
            else
            {
                goTimer.SetActive(false);
                rootDragonOpt.FindChild("proc_unlock").gameObject.SetActive(true);
                rootDragonOpt.FindChild("proc_unlock/proc_text").GetComponent <Text>().text = string.Format("{0}/{1}", proc, cost);
                rootDragonOpt.FindChild("proc_unlock/Slider").GetComponent <Slider>().value = proc / (float)cost;
            }

            string    strDragonId = dragonId.ToString();
            Transform tfDesc      = rootDragonOpt.FindChild("descBg/desc");

            for (int i = 0; i < tfDesc.childCount; i++)
            {
                GameObject goDesc = tfDesc.GetChild(i).gameObject;
                if (!goDesc.name.Equals(strDragonId))
                {
                    goDesc.SetActive(false);
                }
                else
                {
                    goDesc.SetActive(true);
                }
            }
            if (isDead)
            {
                rootDragonOpt.FindChild("btn_do/Create").gameObject.SetActive(false);
                rootDragonOpt.FindChild("btn_do/Unlock").gameObject.SetActive(false);
                rootDragonOpt.FindChild("btn_do/Go").GetComponent <Button>().interactable = false;
            }
            else
            {
                if (A3_LegionModel.getInstance().myLegion.clanc < 3)
                {
                    rootDragonOpt.FindChild("btn_do/Create").gameObject.SetActive(false);
                }
                rootDragonOpt.FindChild("btn_do/Go").GetComponent <Button>().interactable = true;
                if (isUnlocked)
                {
                    if (!isOpened)
                    {
                        rootDragonOpt.FindChild("btn_do/Unlock").gameObject.SetActive(false);
                        rootDragonOpt.FindChild("btn_do/Create").gameObject.SetActive(!isCreated);
                        rootDragonOpt.FindChild("btn_do/Create").GetComponent <Button>().interactable = proc >= cost;
                    }
                    else
                    {
                        rootDragonOpt.FindChild("btn_do/Create").gameObject.SetActive(false);
                        rootDragonOpt.FindChild("btn_do/Unlock").gameObject.SetActive(false);
                        rootDragonOpt.FindChild("btn_do/Go").gameObject.SetActive(isCreated);
                    }
                }
                else
                {
                    if (!isCreated)
                    {
                        rootDragonOpt.FindChild("btn_do/Unlock").gameObject.SetActive(true);
                        rootDragonOpt.FindChild("btn_do/Unlock").GetComponent <Button>().interactable = A3_SlayDragonModel.getInstance().IsAbleToUnlock();
                        rootDragonOpt.FindChild("btn_do/Go").gameObject.SetActive(false);
                    }
                }
            }
        }