Example #1
0
    public string GetAttriubteDisplay(AIHitParams type, float value, Color typeColor, Color valueColor)
    {
        string valueStr;

        if (IsPercentFormat(type))
        {
            value    = value * 100;
            value    = Mathf.Round(value * 10) / 10.0f;
            valueStr = String.Format("{0:F1}", value) + "%";
        }
        else
        {
            value    = Mathf.Round(value * 10) / 10.0f;
            valueStr = value.ToString();
        }

        string typeColorString  = NGUITools.EncodeColor(typeColor);
        string valueColorString = NGUITools.EncodeColor(valueColor);

        EquipmentFSData fsData             = EquipmentFSDataList.GetFSDataByAttribute(type);
        string          localizationString = Localization.Localize(fsData.ids);

        if (localizationString.IndexOf("{0}") != -1)
        {
            return(string.Format(localizationString, "[" + valueColorString + "]" + valueStr + "[-]"));
        }
        else
        {
            return("[" + typeColorString + "]" + localizationString +
                   " : [" + valueColorString + "]" + valueStr + "[-]");
        }
    }
Example #2
0
        private void Awake()
        {
            s_Instance                   = this;
            m_MinimpaRenderTex           = new RenderTexture(320, 320, 8, RenderTextureFormat.ARGB32);
            m_MinimpaRenderTex.name      = "MinimapRT";
            m_MinimpaRenderTex.hideFlags = HideFlags.DontSave;
            Camera component = m_MapCamera.GetComponent <Camera>();

            component.targetTexture = m_MinimpaRenderTex;
            component.rect          = new Rect(0f, 0f, 1f, 1f);
            m_actionColorHex        = "[" + NGUITools.EncodeColor(m_actionColor) + "]";
            ReadOnlyCollection <BaseObject> objects = LegacyLogic.Instance.WorldManager.Objects;

            foreach (BaseObject p_baseObj in objects)
            {
                CreateSymbolView(p_baseObj);
            }
            OnSpiritBeaconUpdate(null, null);
            OnOptionsChanged(null, null);
            if (!LegacyLogic.Instance.MapLoader.IsLoading && LegacyLogic.Instance.MapLoader.Grid != null)
            {
                OnFinishLoadScene(null, null);
            }
            LegacyLogic.Instance.EventManager.RegisterEvent(EEventType.SPAWN_BASEOBJECT, new EventHandler(OnSpawnBaseObject));
            LegacyLogic.Instance.EventManager.RegisterEvent(EEventType.DESTROY_BASEOBJECT, new EventHandler(OnDestroyBaseObject));
            LegacyLogic.Instance.EventManager.RegisterEvent(EEventType.FINISH_SCENE_LOAD, new EventHandler(OnFinishLoadScene));
            LegacyLogic.Instance.EventManager.RegisterEvent(EEventType.START_SCENE_LOAD, new EventHandler(OnStartSceneLoad));
            LegacyLogic.Instance.EventManager.RegisterEvent(EEventType.SPIRIT_BEACON_UPDATE, new EventHandler(OnSpiritBeaconUpdate));
            LegacyLogic.Instance.EventManager.RegisterEvent(EEventType.OPTIONS_CHANGED, new EventHandler(OnOptionsChanged));
        }
Example #3
0
    public string GetDisplayName()
    {
        string displayName = Localization.instance.Get(this.nameIDS);

        Color color = FCConst.RareColorMapping[(EnumRareLevel)this.rareLevel];

        return(string.Format("[{0}]{1}[-]", NGUITools.EncodeColor(color), displayName));
    }
Example #4
0
 public override void OnUpdate()
 {
     if (_lastColor != color.Value)
     {
         _lastColor        = color.Value;
         colorString.Value = NGUITools.EncodeColor(_lastColor);
     }
 }
Example #5
0
 private void Awake()
 {
     m_labelRankColor = m_labelRank.color;
     m_labelNameColor = m_labelName.color;
     m_bonusColorHex  = "[" + NGUITools.EncodeColor(m_bonusColor) + "]";
     m_iconColor      = m_icon.color;
     LegacyLogic.Instance.EventManager.RegisterEvent(EEventType.CHARACTER_SKILL_CHANGED, new EventHandler(OnSkillChangedEvent));
 }
Example #6
0
 private void Init()
 {
     if (!m_initialized)
     {
         m_attributetColorHex         = "[" + NGUITools.EncodeColor(m_attributetColor) + "]";
         m_nextLevelAttributeColorHex = "[" + NGUITools.EncodeColor(m_nextLevelAttributeColor) + "]";
         m_initialized = true;
     }
 }
Example #7
0
 private void Init()
 {
     if (!m_initialized)
     {
         m_effectColorHex          = "[" + NGUITools.EncodeColor(m_effectColor) + "]";
         m_unlearnedEffectColorHex = "[" + NGUITools.EncodeColor(m_unlearnedEffectColor) + "]";
         m_initialized             = true;
     }
 }
 public void Init()
 {
     m_headLineColorHex = "[" + NGUITools.EncodeColor(m_headLineColor) + "]";
     m_textColorHex     = "[" + NGUITools.EncodeColor(m_textColor) + "]";
     m_maxHp.Init(LocaManager.GetText("CHARACTER_ATTRIBUTE_HEALTH"));
     m_meleeDmg.Init(LocaManager.GetText("CHARACTER_DAMAGE"));
     m_meleeStrikes.Init(LocaManager.GetText("MONSTER_ATTACK_MELEE_STRIKES"));
     m_rangeDmg.Init(LocaManager.GetText("CHARACTER_DAMAGE"));
     m_rangeStrikes.Init(LocaManager.GetText("MONSTER_ATTACK_RANGED_STRIKES"));
     m_armor.Init(LocaManager.GetText("CHARACTER_DEFENSE_AC"));
     m_meleeAttackValue.Init(LocaManager.GetText("BESTIARY_STAT_ATTACK_VALUE"));
     m_rangeAttackValue.Init(LocaManager.GetText("BESTIARY_STAT_ATTACK_VALUE"));
     m_rangeAttackRange.Init(LocaManager.GetText("MONSTER_ATTACK_RANGE"));
     m_blockAttempts.Init(LocaManager.GetText("CHARACTER_DEFENSE_GENERAL_BLOCK_ATTEMPTS"));
     m_critMagic.Init(LocaManager.GetText("CHARACTER_CRITICAL_DAMAGE"));
     m_critMelee.Init(LocaManager.GetText("CHARACTER_CRITICAL_DAMAGE"));
     m_critRange.Init(LocaManager.GetText("CHARACTER_CRITICAL_DAMAGE"));
     m_evade.Init(LocaManager.GetText("CHARACTER_DEFENSE_EVADE_VALUE"));
     m_resiPrimordial.Init(LocaManager.GetText("CHARACTER_RESISTANCE_PRIMORDIAL"));
     m_resiFire.Init(LocaManager.GetText("CHARACTER_RESISTANCE_FIRE"));
     m_resiWater.Init(LocaManager.GetText("CHARACTER_RESISTANCE_WATER"));
     m_resiEarth.Init(LocaManager.GetText("CHARACTER_RESISTANCE_EARTH"));
     m_resiAir.Init(LocaManager.GetText("CHARACTER_RESISTANCE_AIR"));
     m_resiLight.Init(LocaManager.GetText("CHARACTER_RESISTANCE_LIGHT"));
     m_resiDark.Init(LocaManager.GetText("CHARACTER_RESISTANCE_DARK"));
     m_spells = new List <MonsterStatEntry>();
     m_spells.Add(m_firstSpell);
     m_spells.Add(m_secondSpell);
     m_spells.Add(m_thirdSpell);
     m_specials = new List <MonsterStatEntry>();
     m_specials.Add(m_firstSpecial);
     m_specials.Add(m_secondSpecial);
     m_specials.Add(m_thirdSpecial);
     m_tooltipMapper = new Dictionary <CharacterStatEntry, String>();
     m_tooltipMapper.Add(m_maxHp, "BESTIARY_STAT_ATTRIBUTE_HEALTH_TT");
     m_tooltipMapper.Add(m_meleeDmg, "BESTIARY_STAT_ATTACK_DAMAGE_TT");
     m_tooltipMapper.Add(m_meleeStrikes, "BESTIARY_STAT_STRIKES_TT");
     m_tooltipMapper.Add(m_rangeDmg, "BESTIARY_STAT_ATTACK_DAMAGE_TT");
     m_tooltipMapper.Add(m_rangeStrikes, "BESTIARY_STAT_STRIKES_TT");
     m_tooltipMapper.Add(m_armor, "BESTIARY_STAT_ARMOR_VALUE_TT");
     m_tooltipMapper.Add(m_meleeAttackValue, "BESTIARY_STAT_ATTACK_VALUE_TT");
     m_tooltipMapper.Add(m_rangeAttackValue, "BESTIARY_STAT_ATTACK_VALUE_TT");
     m_tooltipMapper.Add(m_rangeAttackRange, "MONSTER_ATTACK_RANGE_TT");
     m_tooltipMapper.Add(m_blockAttempts, "BESTIARY_STAT_BLOCK_ATTEMPTS_TT");
     m_tooltipMapper.Add(m_critMagic, "BESTIARY_STAT_MAGIC_CRIT_CHANCE_TT");
     m_tooltipMapper.Add(m_critMelee, "BESTIARY_STAT_ATTACK_CRIT_DAMAGE_TT");
     m_tooltipMapper.Add(m_critRange, "BESTIARY_STAT_ATTACK_CRIT_DAMAGE_TT");
     m_tooltipMapper.Add(m_evade, "BESTIARY_STAT_EVADE_VALUE_TT");
     m_tooltipMapper.Add(m_resiPrimordial, "BESTIARY_STAT_RESISTANCE_PRIMORDIAL_TT");
     m_tooltipMapper.Add(m_resiFire, "BESTIARY_STAT_RESISTANCE_FIRE_TT");
     m_tooltipMapper.Add(m_resiWater, "BESTIARY_STAT_RESISTANCE_WATER_TT");
     m_tooltipMapper.Add(m_resiEarth, "BESTIARY_STAT_RESISTANCE_EARTH_TT");
     m_tooltipMapper.Add(m_resiAir, "BESTIARY_STAT_RESISTANCE_AIR_TT");
     m_tooltipMapper.Add(m_resiLight, "BESTIARY_STAT_RESISTANCE_LIGHT_TT");
     m_tooltipMapper.Add(m_resiDark, "BESTIARY_STAT_RESISTANCE_DARK_TT");
     CreateProgressBarSegments();
 }
Example #9
0
        public override void OnEnter()
        {
            _lastColor        = color.Value;
            colorString.Value = NGUITools.EncodeColor(_lastColor);

            if (!everyFrame)
            {
                Finish();
            }
        }
Example #10
0
    public string GetDisplayName()
    {
        ItemData itemData = DataManager.Instance.GetItemData(this.tattooID);

        string displayName = Localization.instance.Get(itemData.nameIds);

        Color color = FCConst.RareColorMapping[(EnumRareLevel)itemData.rareLevel];

        return(string.Format("[{0}]{1}[-]", NGUITools.EncodeColor(color), displayName));
    }
Example #11
0
        public void Init(Party p_party)
        {
            m_party = p_party;
            m_skillpointsColorHex   = "[" + NGUITools.EncodeColor(m_skillpointsColor) + "]";
            m_noSkillpointsColorHex = "[" + NGUITools.EncodeColor(m_noSkillpointsColor) + "]";
            UICheckbox checkBox = m_checkBox;

            checkBox.onStateChange       = (UICheckbox.OnStateChange)Delegate.Combine(checkBox.onStateChange, new UICheckbox.OnStateChange(OnCheckboxStateChanged));
            m_skillTabs.TabIndexChanged += OnSkillTabSelected;
            LegacyLogic.Instance.EventManager.RegisterEvent(EEventType.CHARACTER_SKILL_POINTS_CHANGED, new EventHandler(OnSkillChangedEvent));
        }
Example #12
0
        private void Start()
        {
            m_keyConfigViews           = new Dictionary <EHotkeyType, KeyConfigView>();
            m_requestHighlightColorHex = "[" + NGUITools.EncodeColor(m_requestHighlightColor) + "]";
            AddHotkey(EHotkeyType.MOVE_FORWARD);
            AddHotkey(EHotkeyType.MOVE_LEFT);
            AddHotkey(EHotkeyType.MOVE_BACKWARD);
            AddHotkey(EHotkeyType.MOVE_RIGHT);
            AddHotkey(EHotkeyType.ROTATE_LEFT);
            AddHotkey(EHotkeyType.ROTATE_RIGHT);
            AddEmptyLine();
            AddHotkey(EHotkeyType.INTERACT);
            AddHotkey(EHotkeyType.SELECT_NEXT_INTERACTIVE_OBJECT);
            AddHotkey(EHotkeyType.QUICK_ACTION_SLOT_1);
            AddHotkey(EHotkeyType.QUICK_ACTION_SLOT_2);
            AddHotkey(EHotkeyType.QUICK_ACTION_SLOT_3);
            AddHotkey(EHotkeyType.QUICK_ACTION_SLOT_4);
            AddHotkey(EHotkeyType.QUICK_ACTION_SLOT_5);
            AddHotkey(EHotkeyType.QUICK_ACTION_SLOT_6);
            AddHotkey(EHotkeyType.QUICK_ACTION_SLOT_7);
            AddHotkey(EHotkeyType.QUICK_ACTION_SLOT_8);
            AddHotkey(EHotkeyType.QUICK_ACTION_SLOT_9);
            AddHotkey(EHotkeyType.QUICK_ACTION_SLOT_0);
            AddHotkey(EHotkeyType.REST);
            AddEmptyLine();
            AddHotkey(EHotkeyType.OPEN_INVENTORY);
            AddHotkey(EHotkeyType.OPEN_CLOSE_SPELLBOOK);
            AddHotkey(EHotkeyType.OPEN_CLOSE_SKILLS);
            AddHotkey(EHotkeyType.OPEN_CLOSE_JOURNAL);
            AddHotkey(EHotkeyType.OPEN_CLOSE_BESTIARY);
            AddHotkey(EHotkeyType.OPEN_CLOSE_LORE);
            AddHotkey(EHotkeyType.OPEN_MAP);
            AddHotkey(EHotkeyType.OPEN_AREA_MAP);
            AddHotkey(EHotkeyType.OPEN_CLOSE_MENU);
            AddEmptyLine();
            AddHotkey(EHotkeyType.SELECT_PARTY_MEMBER_1);
            AddHotkey(EHotkeyType.SELECT_PARTY_MEMBER_2);
            AddHotkey(EHotkeyType.SELECT_PARTY_MEMBER_3);
            AddHotkey(EHotkeyType.SELECT_PARTY_MEMBER_4);
            AddHotkey(EHotkeyType.QUICKSAVE);
            AddHotkey(EHotkeyType.QUICKLOAD);
            AddHotkey(EHotkeyType.DISABLE_GUI);
            AddHotkey(EHotkeyType.MAKE_SCREENSHOT);
            m_startPos = m_keysRoot.transform.localPosition;
            m_keysRoot.Reposition();
            UpdateScrollbar();
            UIScrollBar scrollBar = m_scrollBar;

            scrollBar.onChange = (UIScrollBar.OnScrollBarChange)Delegate.Combine(scrollBar.onChange, new UIScrollBar.OnScrollBarChange(OnScrollbarChange));
            ScrollingHelper.InitScrollListeners(this, gameObject);
            m_buttonKeyDelete.isEnabled = false;
            m_buttonKeyDeleteText.color = Color.gray;
        }
Example #13
0
    /// <summary>
    /// Show a tooltip with the tooltip text for the specified item.
    /// </summary>

    static public void ShowItem(InvGameItem item)
    {
        if (item != null)
        {
            InvBaseItem bi = item.baseItem;

            if (bi != null)
            {
                string t = "[" + NGUITools.EncodeColor(item.color) + "]" + item.name + "[-]\n";

                t += "[AFAFAF]Level " + item.itemLevel + " " + bi.slot;

                List <InvStat> stats = item.CalculateStats();

                for (int i = 0, imax = stats.Count; i < imax; ++i)
                {
                    InvStat stat = stats[i];
                    if (stat.amount == 0)
                    {
                        continue;
                    }

                    if (stat.amount < 0)
                    {
                        t += "\n[FF0000]" + stat.amount;
                    }
                    else
                    {
                        t += "\n[00FF00]+" + stat.amount;
                    }

                    if (stat.modifier == InvStat.Modifier.Percent)
                    {
                        t += "%";
                    }
                    t += " " + stat.id;
                    t += "[-]";
                }

                if (!string.IsNullOrEmpty(bi.description))
                {
                    t += "\n[FF9900]" + bi.description;
                }
                ShowText(t);
                return;
            }
        }
        if (mInstance != null)
        {
            mInstance.mTarget = 0f;
        }
    }
    public string Setup()
    {
        item = GetComponent <StoreItem>();
        string formated = "[" + NGUITools.EncodeColor(GetColorQuality(1)) + "]" + item.storeItemInfo.itemName;

        foreach (StoreItemDetail detail in item.storeItemInfo.itemDetail)
        {
            Debug.Log(detail.propertyName);
            formated = string.Format("{0}\n [" + NGUITools.EncodeColor(Color.white) + "]{1}: {2}", formated, detail.propertyName, detail.propertyValue.ToString());
        }

        return(formated);
    }
 private void Awake()
 {
     m_actionColorHex = "[" + NGUITools.EncodeColor(m_actionColor) + "]";
     m_label.alpha    = 0f;
     DelayedEventManager.RegisterEvent(EDelayType.ON_FRAME_END, EEventType.INTERACTIVE_OBJECT_SELECTED, new EventHandler(OnInteractiveObjectSelected));
     DelayedEventManager.RegisterEvent(EDelayType.ON_FRAME_END, EEventType.DOOR_STATE_CHANGED, new EventHandler(OnInteractiveObjectSelected));
     DelayedEventManager.RegisterEvent(EDelayType.ON_FRAME_END, EEventType.CONTAINER_STATE_CHANGED, new EventHandler(OnInteractiveObjectSelected));
     DelayedEventManager.RegisterEvent(EDelayType.ON_FRAME_END, EEventType.BARREL_STATE_CHANGE, new EventHandler(OnInteractiveObjectSelected));
     DelayedEventManager.RegisterEvent(EDelayType.ON_FRAME_END, EEventType.CONTAINER_DONE_LOOTING, new EventHandler(OnInteractiveObjectSelected));
     DelayedEventManager.RegisterEvent(EDelayType.ON_FRAME_END, EEventType.INTERACTIVE_OBJECT_ALL_SELECTIONS_REMOVED, new EventHandler(OnInteractiveObjectAllSelectionsRemoved));
     LegacyLogic.Instance.EventManager.RegisterEvent(EEventType.FINISH_SCENE_LOAD, new EventHandler(OnInteractiveObjectAllSelectionsRemoved));
     m_gameMessageController.OccupacionChangeEvent += OnGameMessageOccupationChanged;
 }
Example #16
0
    private void OnTooltip(bool show)
    {
        var item     = !show ? null : mItem;
        var baseItem = item?.baseItem;

        if (baseItem != null)
        {
            string[] textArray1  = { "[", NGUITools.EncodeColor(item.color), "]", item.name, "[-]\n" };
            var      str2        = string.Concat(textArray1);
            object[] objArray1   = { str2, "[AFAFAF]Level ", item.itemLevel, " ", baseItem.slot };
            var      tooltipText = string.Concat(objArray1);
            var      list        = item.CalculateStats();
            var      num         = 0;
            var      count       = list.Count;
            while (num < count)
            {
                var stat = list[num];
                if (stat.amount != 0)
                {
                    if (stat.amount < 0)
                    {
                        tooltipText = tooltipText + "\n[FF0000]" + stat.amount;
                    }
                    else
                    {
                        tooltipText = tooltipText + "\n[00FF00]+" + stat.amount;
                    }

                    if (stat.modifier == InvStat.Modifier.Percent)
                    {
                        tooltipText = tooltipText + "%";
                    }

                    tooltipText = tooltipText + " " + stat.id + "[-]";
                }

                num++;
            }

            if (!string.IsNullOrEmpty(baseItem.description))
            {
                tooltipText = tooltipText + "\n[FF9900]" + baseItem.description;
            }

            UITooltip.ShowText(tooltipText);
            return;
        }

        UITooltip.ShowText(null);
    }
Example #17
0
 public void Init(Party p_party)
 {
     m_party         = p_party;
     m_colorRed      = new Color(0.75f, 0f, 0f);
     m_colorGreen    = new Color(0f, 0.5f, 0f);
     m_colorRedHex   = "[" + NGUITools.EncodeColor(m_colorRed) + "]";
     m_colorGreenHex = "[" + NGUITools.EncodeColor(m_colorGreen) + "]";
     m_hp.Init(LocaManager.GetText("CHARACTER_ATTRIBUTE_HEALTH"));
     m_mana.Init(LocaManager.GetText("CHARACTER_ATTRIBUTE_MANA"));
     m_might.Init(LocaManager.GetText("CHARACTER_ATTRIBUTE_MIGHT"));
     m_magic.Init(LocaManager.GetText("CHARACTER_ATTRIBUTE_MAGIC"));
     m_perception.Init(LocaManager.GetText("CHARACTER_ATTRIBUTE_PERCEPTION"));
     m_desiny.Init(LocaManager.GetText("CHARACTER_ATTRIBUTE_DESTINY"));
     m_vitality.Init(LocaManager.GetText("CHARACTER_ATTRIBUTE_VITALITY"));
     m_spirit.Init(LocaManager.GetText("CHARACTER_ATTRIBUTE_SPIRIT"));
     m_mainHandAttack.Init(LocaManager.GetText("CHARACTER_ATTACK_MELEE_MAIN"));
     m_mainHandDamage.Init(LocaManager.GetText("CHARACTER_DAMAGE"));
     m_mainHandCritChance.Init(LocaManager.GetText("CHARACTER_CRITICAL_CHANCE"));
     m_mainHandCritDamage.Init(LocaManager.GetText("CHARACTER_CRITICAL_DAMAGE"));
     m_offHandAttack.Init(LocaManager.GetText("CHARACTER_ATTACK_MELEE_OFF"));
     m_offHandDamage.Init(LocaManager.GetText("CHARACTER_DAMAGE"));
     m_offHandCritChance.Init(LocaManager.GetText("CHARACTER_CRITICAL_CHANCE"));
     m_offHandCritDamage.Init(LocaManager.GetText("CHARACTER_CRITICAL_DAMAGE"));
     m_rangedAttack.Init(LocaManager.GetText("CHARACTER_ATTACK_RANGED"));
     m_rangeDamage.Init(LocaManager.GetText("CHARACTER_DAMAGE"));
     m_rangedCritChance.Init(LocaManager.GetText("CHARACTER_CRITICAL_CHANCE"));
     m_rangedCritDamage.Init(LocaManager.GetText("CHARACTER_CRITICAL_DAMAGE"));
     m_magicCritChance.Init(LocaManager.GetText("CHARACTER_CRITICAL_CHANCE"));
     m_magicCritDamage.Init(LocaManager.GetText("CHARACTER_CRITICAL_DAMAGE"));
     m_magicAttackFire.Init(LocaManager.GetText("CHARACTER_RESISTANCE_FIRE"));
     m_magicAttackWater.Init(LocaManager.GetText("CHARACTER_RESISTANCE_WATER"));
     m_magicAttackAir.Init(LocaManager.GetText("CHARACTER_RESISTANCE_AIR"));
     m_magicAttackEarth.Init(LocaManager.GetText("CHARACTER_RESISTANCE_EARTH"));
     m_magicAttackLight.Init(LocaManager.GetText("CHARACTER_RESISTANCE_LIGHT"));
     m_magicAttackDark.Init(LocaManager.GetText("CHARACTER_RESISTANCE_DARK"));
     m_magicAttackPrime.Init(LocaManager.GetText("CHARACTER_RESISTANCE_PRIMORDIAL"));
     m_defAC.Init(LocaManager.GetText("CHARACTER_DEFENSE_AC"));
     m_defEvade.Init(LocaManager.GetText("CHARACTER_DEFENSE_EVADE_VALUE"));
     m_defBlockChance.Init(LocaManager.GetText("CHARACTER_DEFENSE_BLOCK_CHANCE"));
     m_defBlocksGeneral.Init(LocaManager.GetText("CHARACTER_DEFENSE_GENERAL_BLOCK_ATTEMPTS"));
     m_defBlocksMelee.Init(LocaManager.GetText("CHARACTER_DEFENSE_MELEE_BLOCK_ATTEMPTS"));
     m_resiFire.Init(LocaManager.GetText("CHARACTER_RESISTANCE_FIRE"));
     m_resiWater.Init(LocaManager.GetText("CHARACTER_RESISTANCE_WATER"));
     m_resiEarth.Init(LocaManager.GetText("CHARACTER_RESISTANCE_EARTH"));
     m_resiAir.Init(LocaManager.GetText("CHARACTER_RESISTANCE_AIR"));
     m_resiLight.Init(LocaManager.GetText("CHARACTER_RESISTANCE_LIGHT"));
     m_resiDark.Init(LocaManager.GetText("CHARACTER_RESISTANCE_DARK"));
     m_resiPrime.Init(LocaManager.GetText("CHARACTER_RESISTANCE_PRIMORDIAL"));
 }
Example #18
0
    public string Setup()
    {
        item = GetComponent <ItemData>();
        string formated = "[" + NGUITools.EncodeColor(ItemQuailityColorSelector.GetColorForItem(item)) + "]" + item.name;

        foreach (KeyValuePair <string, float> pair in item.stats)
        {
            if (pair.Key == "Not Available")
            {
                continue;
            }

            formated = string.Format("{0}\n [" + NGUITools.EncodeColor(Color.white) + "]{1}: {2}", formated, pair.Key, pair.Value);
        }
        return(formated);
    }
Example #19
0
 public void Init()
 {
     m_colorBuffNameHex  = "[" + NGUITools.EncodeColor(m_colorBuffName) + "]";
     m_colorBuffInfoHex  = "[" + NGUITools.EncodeColor(m_colorBuffInfo) + "]";
     m_tempStringBuilder = new StringBuilder(10);
     m_enableTime        = Time.time + 0.8f;
     if (m_buffIconFX != null)
     {
         GameObject gameObject = (GameObject)Instantiate(m_buffIconFX, m_icon.transform.position, new Quaternion(0f, 0f, 0f, 0f));
         if (gameObject != null)
         {
             gameObject.transform.parent     = transform.parent;
             gameObject.transform.localScale = Vector3.one;
         }
         m_buffIconFX = null;
     }
 }
Example #20
0
    private void OnTooltip(bool show)
    {
        InvGameItem item = !show ? null : this.mItem;

        if (item != null)
        {
            InvBaseItem baseItem = item.baseItem;
            if (baseItem != null)
            {
                string         str         = "[" + NGUITools.EncodeColor(item.color) + "]" + item.name + "[-]\n";
                string         tooltipText = string.Concat(new object[] { str, "[AFAFAF]Level ", item.itemLevel, " ", baseItem.slot });
                List <InvStat> list        = item.CalculateStats();
                int            num         = 0;
                int            count       = list.Count;
                while (num < count)
                {
                    InvStat stat = list[num];
                    if (stat.amount != 0)
                    {
                        if (stat.amount < 0)
                        {
                            tooltipText = tooltipText + "\n[FF0000]" + stat.amount;
                        }
                        else
                        {
                            tooltipText = tooltipText + "\n[00FF00]+" + stat.amount;
                        }
                        if (stat.modifier == InvStat.Modifier.Percent)
                        {
                            tooltipText = tooltipText + "%";
                        }
                        tooltipText = string.Concat(new object[] { tooltipText, " ", stat.id, "[-]" });
                    }
                    num++;
                }
                if (!string.IsNullOrEmpty(baseItem.description))
                {
                    tooltipText = tooltipText + "\n[FF9900]" + baseItem.description;
                }
                UITooltip.ShowText(tooltipText);
                return;
            }
        }
        UITooltip.ShowText(null);
    }
Example #21
0
    private void OnTooltip(bool show)
    {
        InvGameItem invGameItem = (!show) ? null : mItem;

        if (invGameItem != null)
        {
            InvBaseItem baseItem = invGameItem.baseItem;
            if (baseItem != null)
            {
                string text  = "[" + NGUITools.EncodeColor(invGameItem.color) + "]" + invGameItem.name + "[-]\n";
                string text2 = text;
                text = text2 + "[AFAFAF]Level " + invGameItem.itemLevel + " " + baseItem.slot;
                List <InvStat> list = invGameItem.CalculateStats();
                int            i    = 0;
                for (int count = list.Count; i < count; i++)
                {
                    InvStat invStat = list[i];
                    if (invStat.amount != 0)
                    {
                        text = ((invStat.amount >= 0) ? (text + "\n[00FF00]+" + invStat.amount) : (text + "\n[FF0000]" + invStat.amount));
                        if (invStat.modifier == InvStat.Modifier.Percent)
                        {
                            text += "%";
                        }
                        text  = text + " " + invStat.id;
                        text += "[-]";
                    }
                }
                if (!string.IsNullOrEmpty(baseItem.description))
                {
                    text = text + "\n[FF9900]" + baseItem.description;
                }
                UITooltip.ShowText(text);
                return;
            }
        }
        UITooltip.ShowText(null);
    }
Example #22
0
    // Token: 0x060001D5 RID: 469 RVA: 0x0001ECBC File Offset: 0x0001CEBC
    public static int ParseSymbol(string text, int index, List <Color> colors, bool premultiply)
    {
        int length = text.Length;

        if (index + 2 < length)
        {
            if (text[index + 1] == '-')
            {
                if (text[index + 2] == ']')
                {
                    if (colors != null && colors.Count > 1)
                    {
                        colors.RemoveAt(colors.Count - 1);
                    }
                    return(3);
                }
            }
            else if (index + 7 < length && text[index + 7] == ']')
            {
                if (colors != null)
                {
                    Color color = NGUITools.ParseColor(text, index + 1);
                    if (NGUITools.EncodeColor(color) != text.Substring(index + 1, 6).ToUpper())
                    {
                        return(0);
                    }
                    color.a = colors[colors.Count - 1].a;
                    if (premultiply && color.a != 1f)
                    {
                        color = Color.Lerp(NGUITools.mInvisible, color, color.a);
                    }
                    colors.Add(color);
                }
                return(8);
            }
        }
        return(0);
    }
Example #23
0
    public string GetExtraAttributeValueDisplay(AIHitParams type, float value, Color color)
    {
        string valueStr;

        if (IsPercentFormat(type))
        {
            value    = value * 100;
            value    = Mathf.Round(value * 10) / 10.0f;
            valueStr = String.Format("{0:F1}", value) + "%";
        }
        else
        {
            value    = Mathf.Round(value * 10) / 10.0f;
            valueStr = value.ToString();
        }

        string colorString = NGUITools.EncodeColor(color);

        if (null != EquipmentFSDataList.GetFSDataByAttribute(type))
        {
            return(" [" + colorString + "] + " + valueStr + "[-]");
        }
        return("IDS_NULL");
    }
Example #24
0
    public string WrapText(string text, float maxWidth, int maxLineCount, bool encoding, SymbolStyle symbolStyle)
    {
        if (this.mReplacement != null)
        {
            return(this.mReplacement.WrapText(text, maxWidth, maxLineCount, encoding, symbolStyle));
        }
        int num = Mathf.RoundToInt(maxWidth * this.size);

        if (num < 1)
        {
            return(text);
        }
        StringBuilder s            = new StringBuilder();
        int           length       = text.Length;
        int           num3         = num;
        int           previousChar = 0;
        int           startIndex   = 0;
        int           offset       = 0;
        bool          flag         = true;
        bool          flag2        = maxLineCount != 1;
        int           num7         = 1;
        bool          flag3        = (encoding && (symbolStyle != SymbolStyle.None)) && this.hasSymbols;
        bool          isDynamic    = this.isDynamic;

        if (isDynamic)
        {
            this.mDynamicFont.textureRebuildCallback = new Font.FontTextureRebuildCallback(this.OnFontChanged);
            this.mDynamicFont.RequestCharactersInTexture(text, this.mDynamicFontSize, this.mDynamicFontStyle);
            this.mDynamicFont.textureRebuildCallback = null;
        }
        while (offset < length)
        {
            char ch = text[offset];
            if (ch == '\n')
            {
                if (!flag2 || (num7 == maxLineCount))
                {
                    break;
                }
                num3 = num;
                if (startIndex < offset)
                {
                    s.Append(text.Substring(startIndex, (offset - startIndex) + 1));
                }
                else
                {
                    s.Append(ch);
                }
                flag = true;
                num7++;
                startIndex   = offset + 1;
                previousChar = 0;
                goto Label_03E7;
            }
            if (((ch == ' ') && (previousChar != 0x20)) && (startIndex < offset))
            {
                s.Append(text.Substring(startIndex, (offset - startIndex) + 1));
                flag         = false;
                startIndex   = offset + 1;
                previousChar = ch;
            }
            if ((encoding && (ch == '[')) && ((offset + 2) < length))
            {
                if ((text[offset + 1] == '-') && (text[offset + 2] == ']'))
                {
                    offset += 2;
                    goto Label_03E7;
                }
                if ((((offset + 7) < length) && (text[offset + 7] == ']')) && (NGUITools.EncodeColor(NGUITools.ParseColor(text, offset + 1)) == text.Substring(offset + 1, 6).ToUpper()))
                {
                    offset += 7;
                    goto Label_03E7;
                }
            }
            BMSymbol symbol    = !flag3 ? null : this.MatchSymbol(text, offset, length);
            int      mSpacingX = this.mSpacingX;
            if (!isDynamic)
            {
                if (symbol != null)
                {
                    mSpacingX += symbol.advance;
                }
                else
                {
                    BMGlyph glyph = (symbol != null) ? null : this.mFont.GetGlyph(ch);
                    if (glyph == null)
                    {
                        goto Label_03E7;
                    }
                    mSpacingX += (previousChar == 0) ? glyph.advance : (glyph.advance + glyph.GetKerning(previousChar));
                }
            }
            else if (this.mDynamicFont.GetCharacterInfo(ch, out mChar, this.mDynamicFontSize, this.mDynamicFontStyle))
            {
                mSpacingX += Mathf.RoundToInt(mChar.width);
            }
            num3 -= mSpacingX;
            if (num3 < 0)
            {
                if ((flag || !flag2) || (num7 == maxLineCount))
                {
                    s.Append(text.Substring(startIndex, Mathf.Max(0, offset - startIndex)));
                    if (!flag2 || (num7 == maxLineCount))
                    {
                        startIndex = offset;
                        break;
                    }
                    EndLine(ref s);
                    flag = true;
                    num7++;
                    if (ch == ' ')
                    {
                        startIndex = offset + 1;
                        num3       = num;
                    }
                    else
                    {
                        startIndex = offset;
                        num3       = num - mSpacingX;
                    }
                    previousChar = 0;
                    goto Label_03C8;
                }
                while ((startIndex < length) && (text[startIndex] == ' '))
                {
                    startIndex++;
                }
                flag         = true;
                num3         = num;
                offset       = startIndex - 1;
                previousChar = 0;
                if (!flag2 || (num7 == maxLineCount))
                {
                    break;
                }
                num7++;
                EndLine(ref s);
                goto Label_03E7;
            }
            previousChar = ch;
Label_03C8:
            if (!isDynamic && (symbol != null))
            {
                offset      += symbol.length - 1;
                previousChar = 0;
            }
Label_03E7:
            offset++;
        }
        if (startIndex < offset)
        {
            s.Append(text.Substring(startIndex, offset - startIndex));
        }
        return(s.ToString());
    }
Example #25
0
    /// <summary>
    /// Text wrapping functionality. The 'maxWidth' should be in local coordinates (take pixels and divide them by transform's scale).
    /// </summary>

    public bool WrapText(string text, out string finalText, float width, float height, int lines, bool encoding, SymbolStyle symbolStyle)
    {
        if (mReplacement != null)
        {
            return(mReplacement.WrapText(text, out finalText, width, height, lines, encoding, symbolStyle));
        }

        // Zero means unlimited
        if (width == 0f)
        {
            width = 100000f;
        }
        if (height == 0f)
        {
            height = 100000f;
        }

        // Width and height of the line in pixels
        int lineWidth  = Mathf.FloorToInt(width * size);
        int lineHeight = Mathf.FloorToInt(height * size);

        if (lineWidth < 1 || lineHeight < 1)
        {
            finalText = "";
            return(false);
        }

        int maxLineCount = (lines > 0) ? lines : 999999;

        if (height != 0f)
        {
            maxLineCount = Mathf.Min(maxLineCount, Mathf.FloorToInt(height));

            if (maxLineCount == 0)
            {
                finalText = "";
                return(false);
            }
        }

#if DYNAMIC_FONT
        if (mDynamicFont != null)
        {
            mDynamicFont.RequestCharactersInTexture(text, mDynamicFontSize);
        }
#endif
        StringBuilder sb             = new StringBuilder();
        int           textLength     = text.Length;
        int           remainingWidth = lineWidth;
        int           previousChar   = 0;
        int           start          = 0;
        int           offset         = 0;
        bool          lineIsEmpty    = true;
        bool          multiline      = (lines != 1);
        int           lineCount      = 1;
        bool          useSymbols     = encoding && symbolStyle != SymbolStyle.None && hasSymbols;
        bool          dynamic        = isDynamic;

        // Run through all characters
        for (; offset < textLength; ++offset)
        {
            char ch = text[offset];

            // New line character -- start a new line
            if (ch == '\n')
            {
                if (!multiline || lineCount == maxLineCount)
                {
                    break;
                }
                remainingWidth = lineWidth;

                // Add the previous word to the final string
                if (start < offset)
                {
                    sb.Append(text.Substring(start, offset - start + 1));
                }
                else
                {
                    sb.Append(ch);
                }

                lineIsEmpty = true;
                ++lineCount;
                start        = offset + 1;
                previousChar = 0;
                continue;
            }

            // If this marks the end of a word, add it to the final string.
            if (ch == ' ' && previousChar != ' ' && start < offset)
            {
                sb.Append(text.Substring(start, offset - start + 1));
                lineIsEmpty  = false;
                start        = offset + 1;
                previousChar = ch;
            }

            // When encoded symbols such as [RrGgBb] or [-] are encountered, skip past them
            if (encoding && ch == '[')
            {
                if (offset + 2 < textLength)
                {
                    if (text[offset + 1] == '-' && text[offset + 2] == ']')
                    {
                        offset += 2;
                        continue;
                    }
                    else if (offset + 7 < textLength && text[offset + 7] == ']')
                    {
                        if (NGUITools.EncodeColor(NGUITools.ParseColor(text, offset + 1)) == text.Substring(offset + 1, 6).ToUpper())
                        {
                            offset += 7;
                            continue;
                        }
                    }
                }
            }

            // See if there is a symbol matching this text
            BMSymbol symbol = useSymbols ? MatchSymbol(text, offset, textLength) : null;

            // Calculate how wide this symbol or character is going to be
            int glyphWidth = mSpacingX;

            if (!dynamic)
            {
                if (symbol != null)
                {
                    glyphWidth += symbol.advance;
                }
                else
                {
                    // Find the glyph for this character
                    BMGlyph glyph = (symbol == null) ? mFont.GetGlyph(ch) : null;

                    if (glyph != null)
                    {
                        glyphWidth += (previousChar != 0) ? glyph.advance + glyph.GetKerning(previousChar) : glyph.advance;
                    }
                    else
                    {
                        continue;
                    }
                }
            }
#if DYNAMIC_FONT
            else
            {
                if (mDynamicFont.GetCharacterInfo(ch, out mChar, mDynamicFontSize, mDynamicFontStyle))
                {
                    glyphWidth += Mathf.RoundToInt(mChar.width);
                }
            }
#endif
            // Remaining width after this glyph gets printed
            remainingWidth -= glyphWidth;

            // Doesn't fit?
            if (remainingWidth < 0)
            {
                // Can't start a new line
                if (lineIsEmpty || !multiline || lineCount == maxLineCount)
                {
                    // This is the first word on the line -- add it up to the character that fits
                    sb.Append(text.Substring(start, Mathf.Max(0, offset - start)));

                    if (!multiline || lineCount == maxLineCount)
                    {
                        start = offset;
                        break;
                    }
                    EndLine(ref sb);

                    // Start a brand-new line
                    lineIsEmpty = true;
                    ++lineCount;

                    if (ch == ' ')
                    {
                        start          = offset + 1;
                        remainingWidth = lineWidth;
                    }
                    else
                    {
                        start          = offset;
                        remainingWidth = lineWidth - glyphWidth;
                    }
                    previousChar = 0;
                }
                else
                {
                    // Skip all spaces before the word
                    while (start < textLength && text[start] == ' ')
                    {
                        ++start;
                    }

                    // Revert the position to the beginning of the word and reset the line
                    lineIsEmpty    = true;
                    remainingWidth = lineWidth;
                    offset         = start - 1;
                    previousChar   = 0;

                    if (!multiline || lineCount == maxLineCount)
                    {
                        break;
                    }
                    ++lineCount;
                    EndLine(ref sb);
                    continue;
                }
            }
            else
            {
                previousChar = ch;
            }

            // Advance the offset past the symbol
            if (!dynamic && symbol != null)
            {
                offset      += symbol.length - 1;
                previousChar = 0;
            }
        }

        if (start < offset)
        {
            sb.Append(text.Substring(start, offset - start));
        }
        finalText = sb.ToString();
        return(!multiline || offset == textLength || (lines > 0 && lineCount <= lines));
    }
Example #26
0
    /// <summary>
    /// Text wrapping functionality. The 'maxWidth' should be in local coordinates (take pixels and divide them by transform's scale).
    /// </summary>

    public string WrapText(string text, float maxWidth, int maxLineCount, bool encoding, SymbolStyle symbolStyle)
    {
        if (mReplacement != null)
        {
            return(mReplacement.WrapText(text, maxWidth, maxLineCount, encoding, symbolStyle));
        }

        // Width of the line in pixels
        int lineWidth = Mathf.RoundToInt(maxWidth * size);

        if (lineWidth < 1)
        {
            return(text);
        }

        StringBuilder sb             = new StringBuilder();
        int           textLength     = text.Length;
        int           remainingWidth = lineWidth;
        int           previousChar   = 0;
        int           start          = 0;
        int           offset         = 0;
        bool          lineIsEmpty    = true;
        bool          multiline      = (maxLineCount != 1);
        int           lineCount      = 1;

        // Run through all characters
        for (; offset < textLength; ++offset)
        {
            char ch = text[offset];

            // New line character -- start a new line
            if (ch == '\n')
            {
                if (!multiline || lineCount == maxLineCount)
                {
                    break;
                }
                remainingWidth = lineWidth;

                // Add the previous word to the final string
                if (start < offset)
                {
                    sb.Append(text.Substring(start, offset - start + 1));
                }
                else
                {
                    sb.Append(ch);
                }

                lineIsEmpty = true;
                ++lineCount;
                start        = offset + 1;
                previousChar = 0;
                continue;
            }

            // If this marks the end of a word, add it to the final string.
            if (ch == ' ' && previousChar != ' ' && start < offset)
            {
                sb.Append(text.Substring(start, offset - start + 1));
                lineIsEmpty  = false;
                start        = offset + 1;
                previousChar = ch;
            }

            // When encoded symbols such as [RrGgBb] or [-] are encountered, skip past them
            if (encoding && ch == '[')
            {
                if (offset + 2 < textLength)
                {
                    if (text[offset + 1] == '-' && text[offset + 2] == ']')
                    {
                        offset += 2;
                        continue;
                    }
                    else if (offset + 7 < textLength && text[offset + 7] == ']')
                    {
                        if (NGUITools.EncodeColor(NGUITools.ParseColor(text, offset + 1)) == text.Substring(offset + 1, 6).ToUpper())
                        {
                            offset += 7;
                            continue;
                        }
                    }
                }
            }

            // See if there is a symbol matching this text
            BMSymbol symbol = (encoding && symbolStyle != SymbolStyle.None) ? mFont.MatchSymbol(text, offset, textLength) : null;

            // Find the glyph for this character
            BMGlyph glyph = (symbol == null) ? mFont.GetGlyph(ch) : null;

            // Calculate how wide this symbol or character is going to be
            int glyphWidth = mSpacingX;

            if (symbol != null)
            {
                glyphWidth += symbol.width;
            }
            else if (glyph != null)
            {
                glyphWidth += (previousChar != 0) ? glyph.advance + glyph.GetKerning(previousChar) : glyph.advance;
            }
            else
            {
                continue;
            }

            // Remaining width after this glyph gets printed
            remainingWidth -= glyphWidth;

            // Doesn't fit?
            if (remainingWidth < 0)
            {
                // Can't start a new line
                if (lineIsEmpty || !multiline || lineCount == maxLineCount)
                {
                    // This is the first word on the line -- add it up to the character that fits
                    sb.Append(text.Substring(start, Mathf.Max(0, offset - start)));

                    if (!multiline || lineCount == maxLineCount)
                    {
                        start = offset;
                        break;
                    }
                    EndLine(ref sb);

                    // Start a brand-new line
                    lineIsEmpty = true;
                    ++lineCount;

                    if (ch == ' ')
                    {
                        start          = offset + 1;
                        remainingWidth = lineWidth;
                    }
                    else
                    {
                        start          = offset;
                        remainingWidth = lineWidth - glyphWidth;
                    }
                    previousChar = 0;
                }
                else
                {
                    // Skip all spaces before the word
                    while (start < textLength && text[start] == ' ')
                    {
                        ++start;
                    }

                    // Revert the position to the beginning of the word and reset the line
                    lineIsEmpty    = true;
                    remainingWidth = lineWidth;
                    offset         = start - 1;
                    previousChar   = 0;
                    if (!multiline || lineCount == maxLineCount)
                    {
                        break;
                    }
                    ++lineCount;
                    EndLine(ref sb);
                    continue;
                }
            }
            else
            {
                previousChar = ch;
            }

            // Advance the offset past the symbol
            if (symbol != null)
            {
                offset      += symbol.length - 1;
                previousChar = 0;
            }
        }

        if (start < offset)
        {
            sb.Append(text.Substring(start, offset - start));
        }
        return(sb.ToString());
    }
Example #27
0
    // Token: 0x06000339 RID: 825 RVA: 0x00025A5C File Offset: 0x00023C5C
    public string WrapText(string text, float maxWidth, int maxLineCount, bool encoding, UIFont.SymbolStyle symbolStyle)
    {
        if (this.mReplacement != null)
        {
            return(this.mReplacement.WrapText(text, maxWidth, maxLineCount, encoding, symbolStyle));
        }
        int num = Mathf.RoundToInt(maxWidth * (float)this.size);

        if (num < 1)
        {
            return(text);
        }
        StringBuilder stringBuilder = new StringBuilder();
        int           length        = text.Length;
        int           num2          = num;
        int           num3          = 0;
        int           num4          = 0;
        int           i             = 0;
        bool          flag          = true;
        bool          flag2         = maxLineCount != 1;
        int           num5          = 1;
        bool          flag3         = encoding && symbolStyle != UIFont.SymbolStyle.None && this.hasSymbols;
        bool          isDynamic     = this.isDynamic;

        if (isDynamic)
        {
            this.mDynamicFont.textureRebuildCallback = new Font.FontTextureRebuildCallback(this.OnFontChanged);
            this.mDynamicFont.RequestCharactersInTexture(text, this.mDynamicFontSize, this.mDynamicFontStyle);
            this.mDynamicFont.textureRebuildCallback = null;
        }
        while (i < length)
        {
            char c = text[i];
            if (c == '\n')
            {
                if (!flag2 || num5 == maxLineCount)
                {
                    break;
                }
                num2 = num;
                if (num4 < i)
                {
                    stringBuilder.Append(text.Substring(num4, i - num4 + 1));
                }
                else
                {
                    stringBuilder.Append(c);
                }
                flag = true;
                num5++;
                num4 = i + 1;
                num3 = 0;
            }
            else
            {
                if (c == ' ' && num3 != 32 && num4 < i)
                {
                    stringBuilder.Append(text.Substring(num4, i - num4 + 1));
                    flag = false;
                    num4 = i + 1;
                    num3 = (int)c;
                }
                if (encoding && c == '[' && i + 2 < length)
                {
                    if (text[i + 1] == '-' && text[i + 2] == ']')
                    {
                        i += 2;
                        goto IL_3E7;
                    }
                    if (i + 7 < length && text[i + 7] == ']' && NGUITools.EncodeColor(NGUITools.ParseColor(text, i + 1)) == text.Substring(i + 1, 6).ToUpper())
                    {
                        i += 7;
                        goto IL_3E7;
                    }
                }
                BMSymbol bmsymbol = (!flag3) ? null : this.MatchSymbol(text, i, length);
                int      num6     = this.mSpacingX;
                if (!isDynamic)
                {
                    if (bmsymbol != null)
                    {
                        num6 += bmsymbol.advance;
                    }
                    else
                    {
                        BMGlyph bmglyph = (bmsymbol != null) ? null : this.mFont.GetGlyph((int)c);
                        if (bmglyph == null)
                        {
                            goto IL_3E7;
                        }
                        num6 += ((num3 == 0) ? bmglyph.advance : (bmglyph.advance + bmglyph.GetKerning(num3)));
                    }
                }
                else if (this.mDynamicFont.GetCharacterInfo(c, out UIFont.mChar, this.mDynamicFontSize, this.mDynamicFontStyle))
                {
                    num6 += Mathf.RoundToInt(UIFont.mChar.width);
                }
                num2 -= num6;
                if (num2 < 0)
                {
                    if (flag || !flag2 || num5 == maxLineCount)
                    {
                        stringBuilder.Append(text.Substring(num4, Mathf.Max(0, i - num4)));
                        if (!flag2 || num5 == maxLineCount)
                        {
                            num4 = i;
                            break;
                        }
                        UIFont.EndLine(ref stringBuilder);
                        flag = true;
                        num5++;
                        if (c == ' ')
                        {
                            num4 = i + 1;
                            num2 = num;
                        }
                        else
                        {
                            num4 = i;
                            num2 = num - num6;
                        }
                        num3 = 0;
                    }
                    else
                    {
                        while (num4 < length && text[num4] == ' ')
                        {
                            num4++;
                        }
                        flag = true;
                        num2 = num;
                        i    = num4 - 1;
                        num3 = 0;
                        if (!flag2 || num5 == maxLineCount)
                        {
                            break;
                        }
                        num5++;
                        UIFont.EndLine(ref stringBuilder);
                        goto IL_3E7;
                    }
                }
                else
                {
                    num3 = (int)c;
                }
                if (!isDynamic && bmsymbol != null)
                {
                    i   += bmsymbol.length - 1;
                    num3 = 0;
                }
            }
IL_3E7:
            i++;
        }
        if (num4 < i)
        {
            stringBuilder.Append(text.Substring(num4, i - num4));
        }
        return(stringBuilder.ToString());
    }
Example #28
0
 public static string SetTextColor(string passedString, Color color)
 {
     return(string.Format("[{0}]{1}[-]", NGUITools.EncodeColor(color), passedString));
 }
Example #29
0
        public void FinalizeLevelLoadNew()
        {
            if (((this.CurrentMap != null) && !this.CurrentMap.HasBeenVisited) && ((BonusXpManager.Instance != null) && this.CurrentMap.GivesExplorationXp))
            {
                this.CurrentMap.HasBeenVisited = true;
                int xp = 0;
                if (BonusXpManager.Instance != null)
                {
                    xp = BonusXpManager.Instance.MapExplorationXp;
                }
                object[] parameters = new object[] { this.CurrentMap.DisplayName, xp *PartyHelper.NumPartyMembers };
                global::Console.AddMessage("[" + NGUITools.EncodeColor(Color.yellow) + "]" + global::Console.Format(GUIUtils.GetTextWithLinks(0x661), parameters));
                PartyHelper.AssignXPToParty(xp, false);
            }
            if (OnLevelLoaded != null)
            {
                OnLevelLoaded(Application.loadedLevelName, EventArgs.Empty);
            }
            if (NewGame && (this.Difficulty == GameDifficulty.Easy))
            {
                Option.AutoPause.SetSlowEvent(AutoPauseOptions.PauseEvent.CombatStart, true);
            }
            ScriptEvent.BroadcastEvent(ScriptEvent.ScriptEvents.OnLevelLoaded);
            IsLoading = false;
            if (((s_playerCharacter != null) && !LoadedGame) && (!NewGame && (NumSceneLoads > 0)))
            {
                if (!IEModOptions.SaveBeforeTransition)                 // added this line
                {
                    if (FogOfWar.Instance)
                    {
                        FogOfWar.Instance.WaitForFogUpdate();
                    }
                    AutosaveIfAllowed();
                }
            }
            NewGame = false;
            if (((this.CurrentMap != null) && (this.CouldCampOnLastMap != this.CurrentMap.CanCamp)) && !Option.GetOption(GameOption.BoolOption.DONT_RESTRICT_STASH))
            {
                if (this.CurrentMap.CanCamp)
                {
                    UISystemMessager.Instance.PostMessage(GUIUtils.GetText(0x61e), Color.white);
                }
                else
                {
                    UISystemMessager.Instance.PostMessage(GUIUtils.GetText(0x61d), Color.white);
                }
            }
            NumSceneLoads++;
            FatigueCamera.CreateCamera();
            GammaCamera.CreateCamera();
            WinCursor.Clip(true);

            // in here you can place something like if (CurrentMap.SceneName == "AR_0011_Dyrford_Tavern_02") make_an_NPC; or change_NPC's_stats;
            // added this code
            mod_CommandLine.InjectDropInvButton();

            if (PlayerPrefs.GetInt("UseCustomUi", 0) == 1 && PlayerPrefs.GetInt("AppliedCustomUi", 0) == 0)
            {
                Debug.Log("P! start if block");
                mod_CommandLine.CustomUiApplyOnce();
                PlayerPrefs.SetInt("AppliedCustomUi", 1);
                mod_CommandLine.RepositionUi();
            }

            if (IEModOptions.FixBackerNames)
            {
                mod_CommandLine.FixBackerNames(true);
            }
            else
            {
                mod_CommandLine.FixBackerNames(false);
            }
            // end of added code
        }
Example #30
0
    public string WrapText(string text, float maxWidth, int maxLineCount, bool encoding, SymbolStyle symbolStyle)
    {
        if (mReplacement != null)
        {
            return(mReplacement.WrapText(text, maxWidth, maxLineCount, encoding, symbolStyle));
        }

        var num = Mathf.RoundToInt(maxWidth * size);

        if (num < 1)
        {
            return(text);
        }

        var s            = new StringBuilder();
        var length       = text.Length;
        var num3         = num;
        var previousChar = 0;
        var startIndex   = 0;
        var offset       = 0;
        var flag         = true;
        var flag2        = maxLineCount != 1;
        var num7         = 1;
        var flag3        = encoding && symbolStyle != SymbolStyle.None && hasSymbols;
        var isDynamic    = this.isDynamic;

        if (isDynamic)
        {
            mDynamicFont.textureRebuildCallback = OnFontChanged;
            mDynamicFont.RequestCharactersInTexture(text, mDynamicFontSize, mDynamicFontStyle);
            mDynamicFont.textureRebuildCallback = null;
        }

        while (offset < length)
        {
            var ch = text[offset];
            if (ch == '\n')
            {
                if (!flag2 || num7 == maxLineCount)
                {
                    break;
                }

                num3 = num;
                if (startIndex < offset)
                {
                    s.Append(text.Substring(startIndex, offset - startIndex + 1));
                }
                else
                {
                    s.Append(ch);
                }

                flag = true;
                num7++;
                startIndex   = offset + 1;
                previousChar = 0;
                goto Label_03E7;
            }

            if (ch == ' ' && previousChar != 32 && startIndex < offset)
            {
                s.Append(text.Substring(startIndex, offset - startIndex + 1));
                flag         = false;
                startIndex   = offset + 1;
                previousChar = ch;
            }

            if (encoding && ch == '[' && offset + 2 < length)
            {
                if (text[offset + 1] == '-' && text[offset + 2] == ']')
                {
                    offset += 2;
                    goto Label_03E7;
                }

                if (offset + 7 < length && text[offset + 7] == ']' && NGUITools.EncodeColor(NGUITools.ParseColor(text, offset + 1)) == text.Substring(offset + 1, 6).ToUpper())
                {
                    offset += 7;
                    goto Label_03E7;
                }
            }

            var symbol    = !flag3 ? null : MatchSymbol(text, offset, length);
            var mSpacingX = this.mSpacingX;
            if (!isDynamic)
            {
                if (symbol != null)
                {
                    mSpacingX += symbol.advance;
                }
                else
                {
                    var glyph = symbol != null ? null : mFont.GetGlyph(ch);
                    if (glyph == null)
                    {
                        goto Label_03E7;
                    }

                    mSpacingX += previousChar == 0 ? glyph.advance : glyph.advance + glyph.GetKerning(previousChar);
                }
            }
            else if (mDynamicFont.GetCharacterInfo(ch, out mChar, mDynamicFontSize, mDynamicFontStyle))
            {
                mSpacingX += Mathf.RoundToInt(mChar.width);
            }

            num3 -= mSpacingX;
            if (num3 < 0)
            {
                if (flag || !flag2 || num7 == maxLineCount)
                {
                    s.Append(text.Substring(startIndex, Mathf.Max(0, offset - startIndex)));
                    if (!flag2 || num7 == maxLineCount)
                    {
                        startIndex = offset;
                        break;
                    }

                    EndLine(ref s);
                    flag = true;
                    num7++;
                    if (ch == ' ')
                    {
                        startIndex = offset + 1;
                        num3       = num;
                    }
                    else
                    {
                        startIndex = offset;
                        num3       = num - mSpacingX;
                    }

                    previousChar = 0;
                    goto Label_03C8;
                }

                while (startIndex < length && text[startIndex] == ' ')
                {
                    startIndex++;
                }

                flag         = true;
                num3         = num;
                offset       = startIndex - 1;
                previousChar = 0;
                if (!flag2 || num7 == maxLineCount)
                {
                    break;
                }

                num7++;
                EndLine(ref s);
                goto Label_03E7;
            }

            previousChar = ch;
Label_03C8:
            if (!isDynamic && symbol != null)
            {
                offset      += symbol.length - 1;
                previousChar = 0;
            }

Label_03E7:
            offset++;
        }

        if (startIndex < offset)
        {
            s.Append(text.Substring(startIndex, offset - startIndex));
        }

        return(s.ToString());
    }