示例#1
0
        private TimeSpan GetMinSurrenderTime()
        {
            SysBattleSceneVo dataById = BaseDataMgr.instance.GetDataById <SysBattleSceneVo>(LevelManager.CurBattleId);

            ClientLogger.AssertNotNull(dataById, "vo is null");
            return(TimeSpan.FromMinutes((double)dataById.surrender_time));
        }
        public void ReleaseResource(ResourceHandle handle)
        {
            if (handle == null || !handle.IsVaid)
            {
                return;
            }
            SpawnPool pool = handle.Pool;

            ClientLogger.AssertNotNull(pool, null);
            if (!this._shutdown)
            {
                pool.Despawn(handle.Raw, pool.transform);
            }
            this._handles.RemoveAll((ResourceHandle x) => x == handle);
        }
示例#3
0
        public void InitBaseConfigData()
        {
            string    assetPath = "Assets/_Resources/Data/bindata.xml";
            TextAsset textAsset = Resources.LoadAssetAtPath(assetPath, typeof(TextAsset)) as TextAsset;

            if (textAsset != null)
            {
                object obj = SerializerUtils.binaryDeserialize(textAsset.bytes);
                ClientLogger.AssertNotNull(obj, "bindata is invalid");
                this.init(obj);
                this.parse();
                Resources.UnloadAsset(textAsset);
                BaseDataMgr.instance.IsBaseDataInit = true;
            }
        }
示例#4
0
        private void SelectServer()
        {
            ServerListModelData serverInfo = ModelManager.Instance.Get_serverInfo();

            ClientLogger.AssertNotNull(serverInfo, "serverInfo == null");
            string tcpaddress = serverInfo.serverlist.Find((ServerInfo obj) => obj.serverid == serverInfo.ServerId).tcpaddress;
            string sessionId  = serverInfo.SessionId;
            string lobbyId    = serverInfo.LobbyId;

            SendMsgManager.Instance.SendGateSelfChannelMessage(20, new SendMsgManager.SendMsgParam(true, string.Empty, true, 15f), new object[]
            {
                tcpaddress,
                sessionId,
                lobbyId
            });
        }
示例#5
0
        public UIBloodBar CreateHudBar(Units player)
        {
            ClientLogger.AssertNotNull(player, null);
            if (player == null)
            {
                return(null);
            }
            if (!this.IsOpened)
            {
                CtrlManager.OpenWindow(WindowID.CharacterView, null);
            }
            this.TryShow();
            UIBloodBar uIBloodBar;

            if (player.mHpBar)
            {
                uIBloodBar = player.mHpBar;
            }
            else
            {
                Transform hudBarParent = this.GetHudBarParent(player);
                if (player.isHero)
                {
                    if (player.tag == "Player")
                    {
                        uIBloodBar = this._barRecycler.Create("MainHeroSlider", hudBarParent, player);
                    }
                    else
                    {
                        uIBloodBar = this._barRecycler.Create("HeroSlider", hudBarParent, player);
                    }
                }
                else if (TagManager.CheckTag(player, global::TargetTag.EyeUnit))
                {
                    uIBloodBar = this._barRecycler.Create("EyeSlider", hudBarParent, player);
                }
                else if (player.isMonster)
                {
                    if (player.isCreep)
                    {
                        uIBloodBar = this._barRecycler.Create("CreepSlider", hudBarParent, player);
                    }
                    else
                    {
                        if (player.UnitType == UnitType.Pet)
                        {
                            return(null);
                        }
                        if (player.UnitType == UnitType.SummonMonster)
                        {
                            uIBloodBar = this._barRecycler.Create("SummonerMonsterSlider", hudBarParent, player);
                        }
                        else
                        {
                            uIBloodBar = this._barRecycler.Create("MonsterSlider", hudBarParent, player);
                        }
                    }
                }
                else
                {
                    if (!player.isTower && !player.isHome)
                    {
                        return(null);
                    }
                    uIBloodBar = this._barRecycler.Create("TowerSlider", hudBarParent, player);
                }
                uIBloodBar.name = player.name;
                uIBloodBar.SetTargetUnit(player);
                if (LevelManager.Instance.IsPvpBattleType && (player.isHero || player.isCreep))
                {
                    if (player.isHero)
                    {
                        uIBloodBar.ShowName(true, player.summonerName, player.unique_id);
                    }
                    else
                    {
                        SysMonsterMainVo monsterMainData = BaseDataMgr.instance.GetMonsterMainData(player.npc_id);
                        uIBloodBar.ShowName(true, LanguageManager.Instance.GetStringById(monsterMainData.name), 0);
                    }
                }
                else if (player.isHero && player.tag != "Player")
                {
                    SysHeroMainVo heroMainData = BaseDataMgr.instance.GetHeroMainData(player.npc_id);
                    uIBloodBar.ShowName(true, LanguageManager.Instance.GetStringById(heroMainData.name) + LanguageManager.Instance.GetStringById("BattleAiText_Computer"), 0);
                }
                else if (player.isCreep)
                {
                    SysMonsterMainVo monsterMainData2 = BaseDataMgr.instance.GetMonsterMainData(player.npc_id);
                    uIBloodBar.ShowName(true, LanguageManager.Instance.GetStringById(monsterMainData2.name), 0);
                }
                else
                {
                    uIBloodBar.ShowName(false, null, 0);
                }
                uIBloodBar.transform.localScale = player.surface.HudbarLocalScale;
            }
            uIBloodBar.UpdateHudBarType(player);
            return(uIBloodBar);
        }