Exemple #1
0
        protected override void Update()
        {
            base.Update();

            if (!CacheCanvas.enabled)
            {
                return;
            }

            if (uiTextLevel != null)
            {
                uiTextLevel.text = string.Format(
                    LanguageManager.GetText(formatKeyLevel),
                    Data == null ? "0" : Data.Level.ToString("N0"));
            }

            currentMp             = 0;
            maxMp                 = 0;
            castingSkillCountDown = 0;
            castingSkillDuration  = 0;
            if (Data != null)
            {
                currentMp             = Data.CurrentMp;
                maxMp                 = Data.CacheMaxMp;
                castingSkillCountDown = Data.castingSkillCountDown;
                castingSkillDuration  = Data.castingSkillDuration;
            }
            if (uiGageMp != null)
            {
                uiGageMp.Update(currentMp, maxMp);
            }

            if (uiSkillCastContainer != null)
            {
                uiSkillCastContainer.SetActive(castingSkillCountDown > 0 && castingSkillDuration > 0);
            }

            if (uiTextSkillCast != null)
            {
                uiTextSkillCast.text = string.Format(
                    LanguageManager.GetText(formatKeySkillCastDuration), castingSkillCountDown.ToString("N2"));
            }

            if (imageSkillCastGage != null)
            {
                imageSkillCastGage.fillAmount = castingSkillDuration <= 0 ? 0 : 1 - (castingSkillCountDown / castingSkillDuration);
            }
        }
Exemple #2
0
        protected override void Update()
        {
            base.Update();

            if (!CacheCanvas.enabled)
            {
                return;
            }

            currentHp = 0;
            maxHp     = 0;
            if (Data != null)
            {
                currentHp = Data.CurrentHp;
                maxHp     = Data.MaxHp;
            }
            if (uiGageHp != null)
            {
                uiGageHp.Update(currentHp, maxHp);
            }
        }
Exemple #3
0
        protected override void UpdateUIs()
        {
            if (textGuildName != null)
            {
                textGuildName.text = string.Format(
                    LanguageManager.GetText(formatKeyGuildName),
                    Guild == null ? LanguageManager.GetUnknowTitle() : Guild.guildName);
            }

            if (textLeaderName != null)
            {
                textLeaderName.text = string.Format(
                    LanguageManager.GetText(formatKeyLeaderName),
                    Guild == null ? LanguageManager.GetUnknowTitle() : Guild.GetLeader().characterName);
            }

            if (textLevel != null)
            {
                textLevel.text = string.Format(
                    LanguageManager.GetText(formatKeyLevel),
                    Guild == null ? "0" : Guild.level.ToString("N0"));
            }

            int[] expTree      = GameInstance.Singleton.SocialSystemSetting.GuildExpTree;
            int   currentExp   = 0;
            int   nextLevelExp = 0;

            if (Guild != null && Guild.GetNextLevelExp() > 0)
            {
                currentExp   = Guild.exp;
                nextLevelExp = Guild.GetNextLevelExp();
            }
            else if (Guild != null && Guild.level - 2 > 0 && Guild.level - 2 < expTree.Length)
            {
                int maxExp = expTree[Guild.level - 2];
                currentExp   = maxExp;
                nextLevelExp = maxExp;
            }
            if (uiGageExp != null)
            {
                uiGageExp.Update(currentExp, nextLevelExp);
            }

            if (textSkillPoint != null)
            {
                textSkillPoint.text = string.Format(
                    LanguageManager.GetText(formatKeySkillPoint),
                    Guild == null ? "0" : Guild.skillPoint.ToString("N0"));
            }

            if (Guild == null)
            {
                if (textMessage != null)
                {
                    textMessage.text = string.Format(LanguageManager.GetText(formatKeyMessage), string.Empty);
                }

                if (inputFieldMessage != null)
                {
                    inputFieldMessage.text = string.Empty;
                }
            }

            if (Guild != null && !Guild.guildMessage.Equals(guildMessage))
            {
                guildMessage = Guild.guildMessage;

                if (textMessage != null)
                {
                    textMessage.text = string.Format(LanguageManager.GetText(formatKeyMessage), guildMessage);
                }

                if (inputFieldMessage != null)
                {
                    inputFieldMessage.text = guildMessage;
                }
            }

            base.UpdateUIs();
        }
Exemple #4
0
        protected override void UpdateData()
        {
            if (uiTextName != null)
            {
                uiTextName.text = string.Format(
                    LanguageManager.GetText(formatKeyName),
                    string.IsNullOrEmpty(Data.socialCharacter.characterName) ? LanguageManager.GetUnknowTitle() : Data.socialCharacter.characterName);
            }

            if (uiTextLevel != null)
            {
                uiTextLevel.text = string.Format(
                    LanguageManager.GetText(formatKeyLevel),
                    Data.socialCharacter.level.ToString("N0"));
            }

            // Hp
            int currentHp = Data.socialCharacter.currentHp;
            int maxHp     = Data.socialCharacter.maxHp;

            if (uiGageHp != null)
            {
                uiGageHp.Update(currentHp, maxHp);
                if (uiGageHp.textValue != null)
                {
                    uiGageHp.textValue.gameObject.SetActive(maxHp > 0);
                }
            }

            // Mp
            int currentMp = Data.socialCharacter.currentMp;
            int maxMp     = Data.socialCharacter.maxMp;

            if (uiGageMp != null)
            {
                uiGageMp.Update(currentMp, maxMp);
                if (uiGageMp.textValue != null)
                {
                    uiGageMp.textValue.gameObject.SetActive(maxMp > 0);
                }
            }

            // Buffs
            if (uiCharacterBuffs != null)
            {
                uiCharacterBuffs.UpdateData(Data.characterEntity);
            }

            // Member status
            foreach (GameObject obj in memberIsOnlineObjects)
            {
                if (obj != null)
                {
                    obj.SetActive(uiSocialGroup.IsOnline(Data.socialCharacter.id));
                }
            }

            foreach (GameObject obj in memberIsNotOnlineObjects)
            {
                if (obj != null)
                {
                    obj.SetActive(!uiSocialGroup.IsOnline(Data.socialCharacter.id));
                }
            }

            foreach (GameObject obj in memberIsLeaderObjects)
            {
                if (obj != null)
                {
                    obj.SetActive(!string.IsNullOrEmpty(Data.socialCharacter.id) && uiSocialGroup.IsLeader(Data.socialCharacter.id));
                }
            }

            foreach (GameObject obj in memberIsNotLeaderObjects)
            {
                if (obj != null)
                {
                    obj.SetActive(string.IsNullOrEmpty(Data.socialCharacter.id) || !uiSocialGroup.IsLeader(Data.socialCharacter.id));
                }
            }

            // Character class data
            PlayerCharacter character = null;

            GameInstance.PlayerCharacters.TryGetValue(Data.socialCharacter.dataId, out character);
            if (uiCharacterClass != null)
            {
                uiCharacterClass.Data = character;
            }
        }
Exemple #5
0
        protected override void UpdateUI()
        {
            Profiler.BeginSample("UICharacter - Update UI");

            if (uiTextName != null)
            {
                uiTextName.text = string.Format(
                    LanguageManager.GetText(formatKeyName),
                    Data == null ? LanguageManager.GetUnknowTitle() : Data.CharacterName);
            }

            if (uiTextLevel != null)
            {
                uiTextLevel.text = string.Format(
                    LanguageManager.GetText(formatKeyLevel),
                    Data == null ? "0" : Data.Level.ToString("N0"));
            }

            int[] expTree      = GameInstance.Singleton.ExpTree;
            int   currentExp   = 0;
            int   nextLevelExp = 0;

            if (Data != null && Data.GetNextLevelExp() > 0)
            {
                currentExp   = Data.Exp;
                nextLevelExp = Data.GetNextLevelExp();
            }
            else if (Data != null && Data.Level - 2 > 0 && Data.Level - 2 < expTree.Length)
            {
                int maxExp = expTree[Data.Level - 2];
                currentExp   = maxExp;
                nextLevelExp = maxExp;
            }
            if (uiGageExp != null)
            {
                uiGageExp.Update(currentExp, nextLevelExp);
            }

            // Player character data
            IPlayerCharacterData playerCharacter = Data as IPlayerCharacterData;

            if (uiTextStatPoint != null)
            {
                uiTextStatPoint.text = string.Format(
                    LanguageManager.GetText(formatKeyStatPoint),
                    playerCharacter == null ? "0" : playerCharacter.StatPoint.ToString("N0"));
            }

            if (uiTextSkillPoint != null)
            {
                uiTextSkillPoint.text = string.Format(
                    LanguageManager.GetText(formatKeySkillPoint),
                    playerCharacter == null ? "0" : playerCharacter.SkillPoint.ToString("N0"));
            }

            if (uiTextGold != null)
            {
                uiTextGold.text = string.Format(
                    LanguageManager.GetText(formatKeyGold),
                    playerCharacter == null ? "0" : playerCharacter.Gold.ToString("N0"));
            }

            BaseCharacter character = Data == null ? null : Data.GetDatabase();

            if (uiCharacterClass != null)
            {
                uiCharacterClass.Data = character;
            }

            Profiler.EndSample();
        }
Exemple #6
0
        protected override void Update()
        {
            base.Update();

            Profiler.BeginSample("UICharacter - Update UI (Immediately)");
            // Hp
            int currentHp = 0;
            int maxHp     = 0;

            if (Data != null)
            {
                currentHp = Data.CurrentHp;
                maxHp     = Data.CacheMaxHp;
            }
            if (uiGageHp != null)
            {
                uiGageHp.Update(currentHp, maxHp);
            }

            // Mp
            int currentMp = 0;
            int maxMp     = 0;

            if (Data != null)
            {
                currentMp = Data.CurrentMp;
                maxMp     = Data.CacheMaxMp;
            }
            if (uiGageMp != null)
            {
                uiGageMp.Update(currentMp, maxMp);
            }

            // Stamina
            int currentStamina = 0;
            int maxStamina     = 0;

            if (Data != null)
            {
                currentStamina = Data.CurrentStamina;
                maxStamina     = Data.CacheMaxStamina;
            }
            if (uiGageStamina != null)
            {
                uiGageStamina.Update(currentStamina, maxStamina);
            }

            // Food
            int currentFood = 0;
            int maxFood     = 0;

            if (Data != null)
            {
                currentFood = Data.CurrentFood;
                maxFood     = Data.CacheMaxFood;
            }
            if (uiGageFood != null)
            {
                uiGageFood.Update(currentFood, maxFood);
            }

            // Water
            int currentWater = 0;
            int maxWater     = 0;

            if (Data != null)
            {
                currentWater = Data.CurrentWater;
                maxWater     = Data.CacheMaxWater;
            }
            if (uiGageWater != null)
            {
                uiGageWater.Update(currentWater, maxWater);
            }

            Profiler.EndSample();
        }