public static Dictionary <int, string> GetCategoryMap(STRING_CATEGORY category)
    {
        Dictionary <int, string> categoryMap = new Dictionary <int, string>();

        if (!Singleton <StringTable> .IsValid())
        {
            return(categoryMap);
        }
        StringTable           i2           = Singleton <StringTable> .I;
        UIntKeyTable <string> uIntKeyTable = i2.stringKeyTable.Get(category.ToString());

        if (uIntKeyTable == null)
        {
            return(categoryMap);
        }
        string[] values = GetAllInCategory(category);
        int      i      = 0;

        uIntKeyTable.ForEachKey(delegate(uint key)
        {
            categoryMap.Add((int)key, values[i]);
            i++;
        });
        return(categoryMap);
    }
    public static string[] GetAllInCategory(STRING_CATEGORY category)
    {
        List <string> texts = new List <string>();

        if (!Singleton <StringTable> .IsValid())
        {
            return(texts.ToArray());
        }
        StringTable           i            = Singleton <StringTable> .I;
        UIntKeyTable <string> uIntKeyTable = i.stringKeyTable.Get(category.ToString());

        if (uIntKeyTable == null)
        {
            return(texts.ToArray());
        }
        uIntKeyTable.ForEach(delegate(string text)
        {
            if (string.IsNullOrEmpty(text))
            {
                texts.Add("ERR::STRING_NOT_FOUND");
            }
            else
            {
                texts.Add(text);
            }
        });
        return(texts.ToArray());
    }
    public static string Format(STRING_CATEGORY category, uint id, params object[] args)
    {
        if (!Singleton <StringTable> .IsValid())
        {
            return("ERR::STRING_NOT_FOUND");
        }
        StringTable           i            = Singleton <StringTable> .I;
        UIntKeyTable <string> uIntKeyTable = i.stringKeyTable.Get(category.ToString());

        if (uIntKeyTable == null)
        {
            return("ERR::STRING_NOT_FOUND");
        }
        string text = uIntKeyTable.Get(id);

        if (text == null)
        {
            return("ERR::STRING_NOT_FOUND");
        }
        if (args == null)
        {
            return(text);
        }
        return(string.Format(text, args));
    }
Beispiel #4
0
 public void RequestAnnounce(string enemyName, STRING_CATEGORY category, uint stringID)
 {
     if (AnnounceStart())
     {
         SetupAnnounceInfo(enemyName, category, stringID);
     }
 }
    protected string[] GetTexts(object[] args, STRING_CATEGORY message_categoly = STRING_CATEGORY.COMMON_DIALOG)
    {
        string[] currentSectionTypeParams = MonoBehaviourSingleton <GameSceneManager> .I.GetCurrentSectionTypeParams();

        if (currentSectionTypeParams == null || currentSectionTypeParams.Length < 2)
        {
            List <GameSceneTables.TextData> currentSectionTextList = MonoBehaviourSingleton <GameSceneManager> .I.GetCurrentSectionTextList();

            string[] array = new string[currentSectionTextList.Count];
            if (args != null)
            {
                int i = 0;
                for (int num = array.Length; i < num; i++)
                {
                    array[i] = string.Format(currentSectionTextList[i].text, args);
                }
            }
            else
            {
                int j = 0;
                for (int num2 = array.Length; j < num2; j++)
                {
                    array[j] = currentSectionTextList[j].text;
                }
            }
            return(array);
        }
        int num3 = currentSectionTypeParams.Length;

        string[] array2 = new string[num3 - 1];
        if (args != null && args.Length > 0)
        {
            array2[0] = StringTable.Format(message_categoly, uint.Parse(currentSectionTypeParams[1]), args);
        }
        else
        {
            array2[0] = StringTable.Get(message_categoly, uint.Parse(currentSectionTypeParams[1]));
        }
        if (num3 > 2)
        {
            array2[1] = StringTable.Get(STRING_CATEGORY.COMMON_DIALOG, uint.Parse(currentSectionTypeParams[2]));
        }
        if (num3 > 3)
        {
            array2[2] = StringTable.Get(STRING_CATEGORY.COMMON_DIALOG, uint.Parse(currentSectionTypeParams[3]));
        }
        if (num3 > 4)
        {
            array2[3] = StringTable.Get(STRING_CATEGORY.COMMON_DIALOG, uint.Parse(currentSectionTypeParams[4]));
        }
        return(array2);
    }
    protected void InitDialog(object data_object, STRING_CATEGORY message_category)
    {
        string text = data_object as string;

        if (text == null)
        {
            string[] texts = GetTexts(data_object as object[], message_category);
            base.InitDialog(new Desc(TYPE.OK, (texts.Length <= 0) ? string.Empty : texts[0], (texts.Length <= 1) ? string.Empty : texts[1], null, null, null));
        }
        else
        {
            base.InitDialog(new Desc(TYPE.OK, text, null, null, null, null));
        }
    }
Beispiel #7
0
    private IEnumerator LoadAndSetTips()
    {
        STRING_CATEGORY category   = (!IsRush()) ? STRING_CATEGORY.TIPS : STRING_CATEGORY.RUSH_TIPS;
        int             tips_count = StringTable.GetAllInCategory(category).Length;
        int             tips_index;
        string          tips;

        do
        {
            tips_index = Random.Range(1, tips_count + 1);
            if (MonoBehaviourSingleton <UserInfoManager> .IsValid() && MonoBehaviourSingleton <UserInfoManager> .I.userInfo.name == "/colopl_rob")
            {
                tips_index = 1;
            }
            Debug.Log((object)("Tip Counts: " + tips_count));
            Debug.Log((object)("Tip_Index: " + tips_index));
            tips = StringTable.Get(category, (uint)tips_index);
        }while ((string.IsNullOrEmpty(tips) || tips.Length <= 1) && tips_index != 1);
        LoadObject lo_image = null;

        if (!ResourceManager.internalMode)
        {
            LoadingQueue load_queue = new LoadingQueue(this);
            ResourceManager.enableCache = false;
            lo_image = ((!IsRush()) ? load_queue.Load(RESOURCE_CATEGORY.TIPS_IMAGE, ResourceName.GetTipsImage(tips_index), false) : load_queue.Load(RESOURCE_CATEGORY.RUSH_TIPS_IMAGE, ResourceName.GetRushTipsImage(tips_index), false));
            ResourceManager.enableCache = true;
            if (load_queue.IsLoading())
            {
                yield return((object)load_queue.Wait());
            }
        }
        if (lo_image != null && lo_image.loadedObject != null)
        {
            RemoveTexImage();
            SetTexture((Enum)UI.TEX_IMAGE, lo_image.loadedObject as Texture);
        }
        string tips_title = string.Empty;
        string tips_desc  = string.Empty;
        int    br         = tips.IndexOf('\n');

        if (br >= 0)
        {
            tips_title = tips.Substring(0, br);
            tips_desc  = tips.Substring(br + 1);
        }
        SetLabelText((Enum)UI.LBL_TIPS_TITLE, tips_title);
        SetLabelText((Enum)UI.LBL_TIPS_TITLE_REFLECT, tips_title);
        SetLabelText((Enum)UI.LBL_TIPS, tips_desc);
    }
Beispiel #8
0
    private void SetupAnnounceInfo(string enemyName, STRING_CATEGORY category, uint stringID)
    {
        //IL_0068: Unknown result type (might be due to invalid IL or missing references)
        //IL_0079: Unknown result type (might be due to invalid IL or missing references)
        stateNameBuilder.Length = 0;
        stateNameBuilder.Append(enemyName);
        stateNameBuilder.Append(" ");
        stateNameBuilder.Append(StringTable.Get(category, stringID));
        string text = stateNameBuilder.ToString();

        announce.text            = text;
        announceEffect.text      = text;
        announce.fontStyle       = style;
        announceEffect.fontStyle = style;
    }
    public static string Get(STRING_CATEGORY category, uint id)
    {
        if (!Singleton <StringTable> .IsValid())
        {
            return("ERR::STRING_NOT_FOUND");
        }
        StringTable           i            = Singleton <StringTable> .I;
        UIntKeyTable <string> uIntKeyTable = i.stringKeyTable.Get(category.ToString());

        if (uIntKeyTable == null)
        {
            return("ERR::STRING_NOT_FOUND");
        }
        string text = uIntKeyTable.Get(id);

        return((text != null) ? text : "ERR::STRING_NOT_FOUND");
    }
    public static int[] GetAllKeyInCategory(STRING_CATEGORY category)
    {
        List <int> keys = new List <int>();

        if (!Singleton <StringTable> .IsValid())
        {
            return(keys.ToArray());
        }
        StringTable           i            = Singleton <StringTable> .I;
        UIntKeyTable <string> uIntKeyTable = i.stringKeyTable.Get(category.ToString());

        if (uIntKeyTable == null)
        {
            return(keys.ToArray());
        }
        uIntKeyTable.ForEachKey(delegate(uint key)
        {
            keys.Add((int)key);
        });
        return(keys.ToArray());
    }