예제 #1
0
 public bool FindUIEmoticonDictionary(string key, ref UIEmoticonInfo data)
 {
     if (this.uiEmoticonDictionary.ContainsKey(key))
     {
         data = this.uiEmoticonDictionary[key];
         return(true);
     }
     data = null;
     return(false);
 }
        public static Emoticon EmoticonCharChat(string name, float emoticonWidth, float emoticonHeight, string emoticonKey)
        {
            GameObject gameObject = new GameObject(name);
            Emoticon   emoticon   = gameObject.AddComponent <Emoticon>();

            emoticon.SetUseBoxCollider(false);
            emoticon.gameObject.layer = GUICamera.UILayer;
            emoticon.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT);
            emoticon.AutoAnimatorStop = false;
            UIEmoticonInfo uIEmoticonInfo = NrTSingleton <UIEmoticonManager> .Instance.FindUIEmoticonDictionary(emoticonKey);

            if (uIEmoticonInfo != null)
            {
                emoticon.SetDelay(uIEmoticonInfo.delays);
                UIBaseInfoLoader infoLoader = uIEmoticonInfo.infoLoader;
                if (infoLoader == null)
                {
                    return(emoticon);
                }
                emoticon.SetSpriteTile(infoLoader.Tile, infoLoader.UVs.width / (float)infoLoader.ButtonCount, infoLoader.UVs.height);
                Material material = (Material)CResources.Load(infoLoader.Material);
                emoticon.Setup(emoticonWidth, emoticonHeight, material);
                float pixelToUVsWidth = UIBaseFileManager.GetPixelToUVsWidth(material, infoLoader.UVs.width / (float)infoLoader.ButtonCount);
                Rect  uvs             = new Rect(UIBaseFileManager.GetPixelToUVsWidth(material, infoLoader.UVs.x) - pixelToUVsWidth, 1f - UIBaseFileManager.GetPixelToUVsHeight(material, infoLoader.UVs.y + infoLoader.UVs.height), pixelToUVsWidth, UIBaseFileManager.GetPixelToUVsHeight(material, infoLoader.UVs.height));
                for (int i = 0; i < 3; i++)
                {
                    emoticon.States[i].spriteFrames    = new CSpriteFrame[1];
                    emoticon.States[i].spriteFrames[0] = new CSpriteFrame();
                    uvs.x += pixelToUVsWidth;
                    emoticon.States[i].spriteFrames[0].uvs = uvs;
                    emoticon.animations[i].SetAnim(emoticon.States[i], i);
                }
                emoticon.autoResize = false;
            }
            return(emoticon);
        }
예제 #3
0
        public bool LoadUIEmoticonDictionary()
        {
            if (this.bLoad)
            {
                return(false);
            }
            string    path      = NrTSingleton <UIDataManager> .Instance.FilePath + "UIEmoticonDictionary" + NrTSingleton <UIDataManager> .Instance.AddFilePath;
            TextAsset textAsset = (TextAsset)CResources.Load(path);

            if (null == textAsset)
            {
                TsLog.Log("Failed LoadUIEmoticonDictionary", new object[0]);
                return(false);
            }
            char[] separator = new char[]
            {
                '\t'
            };
            string a  = "1:1";
            string a2 = "1:3";
            string a3 = "3:1";
            string a4 = "3:3";

            string[] array = textAsset.text.Split(new char[]
            {
                '\n'
            });
            for (int i = 0; i < array.Length; i++)
            {
                string[]       array2         = array[i].Split(separator);
                UIEmoticonInfo uIEmoticonInfo = new UIEmoticonInfo();
                uIEmoticonInfo.infoLoader.Material = NrTSingleton <UIDataManager> .Instance.GetString(NrTSingleton <UIDataManager> .Instance.FilePath, "Material/", array2[4]);

                uIEmoticonInfo.infoLoader.UVs = new Rect(float.Parse(array2[5]), float.Parse(array2[6]), float.Parse(array2[7]), float.Parse(array2[8]));
                if (a == array2[9].TrimEnd(new char[0]))
                {
                    uIEmoticonInfo.infoLoader.Tile = SpriteTile.SPRITE_TILE_MODE.STM_MIN;
                }
                else if (a2 == array2[10].TrimEnd(new char[0]))
                {
                    uIEmoticonInfo.infoLoader.Tile = SpriteTile.SPRITE_TILE_MODE.STM_1x3;
                }
                else if (a3 == array2[11].TrimEnd(new char[0]))
                {
                    uIEmoticonInfo.infoLoader.Tile = SpriteTile.SPRITE_TILE_MODE.STM_3x1;
                }
                else if (a4 == array2[12].TrimEnd(new char[0]))
                {
                    uIEmoticonInfo.infoLoader.Tile = SpriteTile.SPRITE_TILE_MODE.STM_3x3;
                }
                else
                {
                    TsLog.Log("Don't Set  " + i, new object[0]);
                }
                uIEmoticonInfo.infoLoader.ButtonCount = byte.Parse(array2[10]);
                if (0 >= uIEmoticonInfo.infoLoader.ButtonCount)
                {
                    TsLog.Log(string.Concat(new object[]
                    {
                        "Wrong Value ButtonCount :",
                        array2[10],
                        "/",
                        i
                    }), new object[0]);
                    uIEmoticonInfo.infoLoader.ButtonCount = 4;
                }
                uIEmoticonInfo.delays[0] = float.Parse(array2[11]);
                uIEmoticonInfo.delays[1] = float.Parse(array2[12]);
                uIEmoticonInfo.delays[2] = float.Parse(array2[13]);
                if (!this.uiEmoticonDictionary.ContainsKey("^" + MsgHandler.HandleReturn <string>("GetTextFromInterface", new object[]
                {
                    array2[0]
                })))
                {
                    this.uiEmoticonDictionary.Add("^" + MsgHandler.HandleReturn <string>("GetTextFromInterface", new object[]
                    {
                        array2[0]
                    }), uIEmoticonInfo);
                    this._EmoticonENGName.Add(array2[2], array2[0]);
                }
                else
                {
                    TsLog.Log(string.Concat(new object[]
                    {
                        "Ű���� �ߺ��Դϴ� = ",
                        array2[0],
                        " ",
                        Time.time
                    }), new object[0]);
                }
            }
            Resources.UnloadAsset(textAsset);
            CResources.Delete(path);
            this.bLoad = true;
            return(true);
        }