public void UpdateRank(TRank?rank)
 {
     if (rank.HasValue && !Rank.Equals(rank.Value))
     {
         Rank     = rank.Value;
         Progress = 0;
     }
 }
示例#2
0
        protected virtual void GUICoreDisplay(ref CharacterBase cc)
        {
            // name of the character
            GUILayout.BeginHorizontal();
            GUILayout.Label("Name", GUILayout.Width(75));
            cc.Name = GUILayout.TextField(cc.Name, GUILayout.ExpandWidth(true));
            GUILayout.EndHorizontal();

            // axis
            GUILayout.BeginHorizontal();
            GUILayout.Label("Axis", GUILayout.Width(75));
            BaseAxis NewAxis = (BaseAxis)EditorGUILayout.EnumPopup(cc.CurrentAxis, GUILayout.ExpandWidth(true));

            if (cc.CurrentAxis != NewAxis)
            {
                cc.CurrentAxis = NewAxis;
                cc.RebuildModifiers();
            }
            GUILayout.EndHorizontal();

            // alignment
            if (cc.CurrentAxis != BaseAxis.Neutral)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label("Alignment", GUILayout.Width(75));
                BaseAlignment NewAlignment = (BaseAlignment)EditorGUILayout.EnumPopup(cc.CurrentAlignment, GUILayout.ExpandWidth(true));
                if (cc.CurrentAlignment != NewAlignment)
                {
                    cc.CurrentAlignment = NewAlignment;
                    cc.RebuildModifiers();
                }
                GUILayout.EndHorizontal();
            }

            // race
            GUILayout.BeginHorizontal();
            GUILayout.Label("Race", GUILayout.Width(75));
            BaseRace NewRace = (BaseRace)EditorGUILayout.EnumPopup(cc.CurrentRace, GUILayout.ExpandWidth(true));

            if (cc.CurrentRace != NewRace)
            {
                cc.CurrentRace = NewRace;
                cc.RebuildModifiers();
            }
            GUILayout.EndHorizontal();

            // class
            GUILayout.BeginHorizontal();
            GUILayout.Label("Class", GUILayout.Width(75));
            BaseClass NewClass = (BaseClass)EditorGUILayout.EnumPopup(cc.CurrentClass, GUILayout.ExpandWidth(true));

            if (cc.CurrentClass != NewClass)
            {
                cc.CurrentClass = NewClass;
                cc.RebuildModifiers();
            }
            GUILayout.EndHorizontal();

            // rank
            GUILayout.BeginHorizontal();
            GUILayout.Label("Rank", GUILayout.Width(75));
            BaseRank NewRank = (BaseRank)EditorGUILayout.EnumPopup(cc.CurrentRank, GUILayout.ExpandWidth(true));

            if (cc.CurrentRank != NewRank)
            {
                cc.CurrentRank = NewRank;
                cc.RebuildModifiers();
            }
            GUILayout.EndHorizontal();

            // life
            GUILayout.BeginHorizontal();
            GUILayout.Label("Life", GUILayout.Width(75));
            GUI.skin.label.alignment = TextAnchor.UpperRight;
            GUILayout.Label(cc.CurrentLife.ToString("#,##0") + "/" + (cc.MAXLife + cc.BonusMAXLife).ToString("#,##0"), GUILayout.ExpandWidth(true));
            GUI.skin.label.alignment = TextAnchor.UpperLeft;
            GUILayout.EndHorizontal();

            // life regen
            GUILayout.BeginHorizontal();
            GUILayout.Label("Life Regen", GUILayout.Width(75));
            GUIGenericValueDisplay(ref cc, ref cc.RegenLife, 0, 999);
            GUI.skin.label.alignment = TextAnchor.UpperRight;
            GUILayout.Label((cc.RegenLife + cc.BonusRegenLife).ToString() + " per sec", GUILayout.ExpandWidth(true));
            GUI.skin.label.alignment = TextAnchor.UpperLeft;
            GUILayout.EndHorizontal();

            // mana
            GUILayout.BeginHorizontal();
            GUILayout.Label("Mana", GUILayout.Width(75));
            GUI.skin.label.alignment = TextAnchor.UpperRight;
            GUILayout.Label(cc.CurrentMana.ToString("#,##0") + "/" + (cc.MAXMana + cc.BonusMAXMana).ToString("#,##0"), GUILayout.ExpandWidth(true));
            GUI.skin.label.alignment = TextAnchor.UpperLeft;
            GUILayout.EndHorizontal();

            // mana regen
            GUILayout.BeginHorizontal();
            GUILayout.Label("Mana Regen", GUILayout.Width(75));
            GUIGenericValueDisplay(ref cc, ref cc.RegenMana, 0, 999);
            GUI.skin.label.alignment = TextAnchor.UpperRight;
            GUILayout.Label((cc.RegenMana + cc.BonusRegenMana).ToString() + " per sec", GUILayout.ExpandWidth(true));
            GUI.skin.label.alignment = TextAnchor.UpperLeft;
            GUILayout.EndHorizontal();


            // stamina
            GUILayout.BeginHorizontal();
            GUILayout.Label("Stamina", GUILayout.Width(75));
            GUI.skin.label.alignment = TextAnchor.UpperRight;
            GUILayout.Label((cc.MAXStamina + cc.BonusMAXStamina).ToString("#,##0"), GUILayout.ExpandWidth(true));  //cc.CurrentStamina.ToString("#,##0") + "/" +
            GUI.skin.label.alignment = TextAnchor.UpperLeft;
            GUILayout.EndHorizontal();

            // armour
            GUILayout.BeginHorizontal();
            GUILayout.Label("Armour", GUILayout.Width(75));
            GUI.skin.label.alignment = TextAnchor.UpperRight;
            GUILayout.Label("Base " + cc.CurrentArmour.ToString("#,##0") + " Equipped " + cc.BonusArmour.ToString("#,##0"), GUILayout.ExpandWidth(true));
            GUI.skin.label.alignment = TextAnchor.UpperLeft;
            GUILayout.EndHorizontal();

            // weight
            GUILayout.BeginHorizontal();
            GUILayout.Label("EquipLoad", GUILayout.Width(75));
            GUI.skin.label.alignment = TextAnchor.UpperRight;
            GUILayout.Label(cc.CurrentEquipLoad.ToString("#,##0") + "/" + cc.MAXEquipLoad.ToString("#,##0"), GUILayout.ExpandWidth(true));
            GUI.skin.label.alignment = TextAnchor.UpperLeft;
            GUILayout.EndHorizontal();


            // XP & next level
            GUILayout.BeginHorizontal();
            GUILayout.Label("XP", GUILayout.Width(75));
            GUI.skin.label.alignment = TextAnchor.UpperRight;
            GUILayout.Label(cc.CurrentXP.ToString("#,##0") + "/" + cc.XPToNextLevel.ToString("#,##0"), GUILayout.ExpandWidth(true));
            GUI.skin.label.alignment = TextAnchor.UpperLeft;
            GUILayout.EndHorizontal();

            // current level
            GUILayout.BeginHorizontal();
            GUILevelDisplay(ref cc);
            GUILayout.EndHorizontal();
        }