Ejemplo n.º 1
0
    public override string FindFileError(string fileName)
    {
        if (Path.IsPathRooted(fileName))
        {
            return(fileName);
        }

        if (Path.GetExtension(fileName) == ".lua")
        {
            fileName = fileName.Substring(0, fileName.Length - 4);
        }

        using (CString.Block())
        {
            CString sb = CString.Alloc(512);

            for (int i = 0; i < searchPaths.Count; i++)
            {
                sb.Append("\n\tno file '").Append(searchPaths[i]).Append('\'');
            }

            sb.Append("\n\tno file './Resources/").Append(fileName).Append(".lua'")
            .Append("\n\tno file '").Append(LuaConst.luaResDir).Append('/')
            .Append(fileName).Append(".lua'");
            sb = sb.Replace("?", fileName);

            return(sb.ToString());
        }
    }
Ejemplo n.º 2
0
    // Token: 0x060019D9 RID: 6617 RVA: 0x002BEF5C File Offset: 0x002BD15C
    public void UpdateNamePos()
    {
        this.RoleNameStr.ClearString();
        CString cstring = StringManager.Instance.StaticString1024();

        if (this.DM.RoleAttr.NickName.Length == 0)
        {
            cstring.Append(this.DM.mStringTable.GetStringByID(9096u));
        }
        else
        {
            cstring.Append(this.DM.RoleAttr.NickName);
        }
        GameConstants.FormatRoleName(this.RoleNameStr, this.DM.RoleAttr.Name, null, cstring, 0, 0, null, null, null, "<color=#4CF5F5>");
        this.RoleName.text = this.RoleNameStr.ToString();
        this.RoleName.SetAllDirty();
        this.RoleName.cachedTextGenerator.Invalidate();
        this.RoleName.cachedTextGeneratorForLayout.Invalidate();
        this.RoleName.fontSize = this.RoleNameSize;
        this.RoleName.fontSize = this.GetFontSize();
        Vector2 anchoredPosition = this.RectChangeName.anchoredPosition;

        anchoredPosition.x = this.RoleName.rectTransform.anchoredPosition.x + this.RoleName.preferredWidth + 27f;
        if (this.RoleName.rectTransform.localScale.x < 0f)
        {
            anchoredPosition.x -= this.RoleName.rectTransform.sizeDelta.x;
        }
        this.RectChangeName.anchoredPosition = anchoredPosition;
    }
Ejemplo n.º 3
0
    // Token: 0x06001BC6 RID: 7110 RVA: 0x00315E68 File Offset: 0x00314068
    public void PraseString(CString NewStr, string str)
    {
        int i = 0;

        while (i < str.Length)
        {
            char c = str[i++];
            if (c == '%')
            {
                char c2 = str[i];
                if (c2 != 'x' && c2 != 'y')
                {
                    if (c2 != 'b')
                    {
                        NewStr.Append(c);
                    }
                    else
                    {
                        NewStr.Append(this.GetCharString(str[i++]));
                    }
                }
                else
                {
                    NewStr.IntToFormat((long)this.GetCharVal(str[i++]), 1, true);
                    NewStr.AppendFormat("{0}");
                }
            }
            else
            {
                NewStr.Append(c);
            }
        }
    }
Ejemplo n.º 4
0
        public string FindFileError(string _fileName)
        {
            if (Path.IsPathRooted(_fileName))
            {
                return(_fileName);
            }

            if (_fileName.EndsWith(".lua"))
            {
                _fileName = _fileName.Substring(0, _fileName.Length - 4);
            }

            using (CString.Block())
            {
                CString tempStr = CString.Alloc(512);
                int     tempPos = _fileName.LastIndexOf('/');
                if (tempPos > 0)
                {
                    int tempIndex = tempPos + 1;
                    tempStr.Append("\n\tno file '").Append(_fileName, tempIndex, _fileName.Length - tempIndex).Append(".lua' in ").Append("lua_");
                    tempIndex = tempStr.Length;
                    tempStr.Append(_fileName, 0, tempPos).Replace('/', '_', tempIndex, tempPos).Append(".unity3d");
                }
                else
                {
                    tempStr.Append("\n\tno file '").Append(_fileName).Append(".lua' in ").Append("lua.unity3d");
                }

                return(tempStr.ToString());
            }
        }
Ejemplo n.º 5
0
    // Token: 0x060008DC RID: 2268 RVA: 0x000B5C4C File Offset: 0x000B3E4C
    public void Recv_MSG_GAMBLE_JACKPOT(MessagePacket MP)
    {
        GamblingManager.GamebleJackpot gamebleJackpot = new GamblingManager.GamebleJackpot();
        gamebleJackpot.KingdomID = MP.ReadUShort(-1);
        MP.ReadStringPlus(3, gamebleJackpot.Tag, -1);
        MP.ReadStringPlus(13, gamebleJackpot.Name, -1);
        uint num = MP.ReadUInt(-1);

        gamebleJackpot.PrizeWins = MP.ReadUInt(-1);
        gamebleJackpot.GameType  = (UIBattle_Gambling.eMode)MP.ReadByte(-1);
        gamebleJackpot.WonTime   = MP.ReadLong(-1);
        bool flag = DataManager.CompareStr(gamebleJackpot.Name, DataManager.Instance.RoleAttr.Name) == 0;

        this.AddJackpotData(gamebleJackpot);
        if (GUIManager.Instance.FindMenu(EGUIWindow.UI_Battle_Gambling) || gamebleJackpot.KingdomID == DataManager.MapDataController.kingdomData.kingdomID)
        {
            DataManager dataManager = DataManager.Instance;
            CString     cstring     = StringManager.Instance.StaticString1024();
            cstring.Append("<color=#FFFF00>");
            cstring.IntToFormat((long)((ulong)gamebleJackpot.PrizeWins), 1, true);
            cstring.AppendFormat(dataManager.mStringTable.GetStringByID(8473u));
            cstring.Append("</color>");
            MapMonster recordByKey  = DataManager.MapDataController.MapMonsterTable.GetRecordByKey(this.m_GambleEventSave.MonsterID);
            HeroTeam   recordByKey2 = dataManager.TeamTable.GetRecordByKey(recordByKey.MapTeamInfo[0].TeamID);
            Hero       recordByKey3 = dataManager.HeroTable.GetRecordByKey(recordByKey2.Arrays[10].Hero);
            CString    cstring2     = StringManager.Instance.StaticString1024();
            GameConstants.FormatRoleName(cstring2, gamebleJackpot.Name, gamebleJackpot.Tag, null, 0, (gamebleJackpot.KingdomID != DataManager.MapDataController.kingdomData.kingdomID) ? gamebleJackpot.KingdomID : 0, null, null, null, null);
            CString cstring3 = StringManager.Instance.StaticString1024();
            cstring3.Append("<color=#FFFF00>");
            cstring3.Append(cstring2);
            cstring3.Append("</color>");
            CString cstring4 = StringManager.Instance.SpawnString(1024);
            cstring4.StringToFormat(cstring3);
            if (gamebleJackpot.GameType == UIBattle_Gambling.eMode.Normal)
            {
                cstring4.StringToFormat(dataManager.mStringTable.GetStringByID(9171u));
            }
            else
            {
                cstring4.StringToFormat(dataManager.mStringTable.GetStringByID(9179u));
            }
            cstring4.StringToFormat(dataManager.mStringTable.GetStringByID((uint)recordByKey3.HeroName));
            cstring4.StringToFormat(cstring);
            cstring4.AppendFormat(dataManager.mStringTable.GetStringByID(9180u));
            this.GambleCountStr.Add(cstring4);
            GUIManager.Instance.SetRunningText(cstring4);
        }
        GUIManager.Instance.UpdateUI(EGUIWindow.UI_Battle_Gambling, 0, 0);
        GUIManager.Instance.UpdateUI(EGUIWindow.UI_Battle_Gambling, 2, 0);
        if (flag)
        {
            GUIManager.Instance.UpdateUI(EGUIWindow.UI_Battle_Gambling, 9, 0);
        }
        GUIManager.Instance.UpdateUI(EGUIWindow.UI_MonsterCrypt, 0, 0);
    }
Ejemplo n.º 6
0
        byte[] ReadZipFile(string fileName)
        {
            AssetBundle zipFile = null;

            byte[] buffer  = null;
            string zipName = null;

            using (CString.Block())
            {
                CString sb = CString.Alloc(256);
                sb.Append("lua");
                int pos = fileName.LastIndexOf('/');

                if (pos > 0)
                {
                    sb.Append("_");
                    sb.Append(fileName, 0, pos).ToLower().Replace('/', '_');

                    //我这里只有一个ab包可以加载 lua
                    sb       = "lua";
                    fileName = fileName.Replace(".", "/");
                    //fileName = fileName.Substring(pos + 1);
                }

                if (!fileName.EndsWith(".lua"))
                {
                    fileName += ".lua";
                }

#if UNITY_5 || UNITY_5_3_OR_NEWER
                fileName += ".bytes";
#endif
                zipName = sb.ToString();
                zipMap.TryGetValue(zipName, out zipFile);
            }

            if (zipFile != null)
            {
#if UNITY_4_6 || UNITY_4_7
                TextAsset luaCode = zipFile.Load(fileName, typeof(TextAsset)) as TextAsset;
#else
                //需要优化 我这里  写死了 拼接ab包的路径   LuaABTemp是ab包内的lua文件的名字
                fileName = "Assets/LuaABTemp/" + fileName;

                TextAsset luaCode = zipFile.LoadAsset <TextAsset>(fileName);
#endif
                if (luaCode != null)
                {
                    buffer = luaCode.bytes;
                    Resources.UnloadAsset(luaCode);
                }
            }

            return(buffer);
        }
Ejemplo n.º 7
0
        byte[] ReadZipFile(string fileName)
        {
            AssetBundle zipFile = null;

            byte[] buffer  = null;
            string zipName = null;

            using (CString.Block())
            {
                CString sb = CString.Alloc(256);
                sb.Append("lua");
                int pos = fileName.IndexOf('/');

                if (pos > 0)
                {
                    sb.Append("_");
                    sb.Append(fileName.Substring(0, pos).ToLower());        //shit, unity5 assetbund'name must lower
                    sb.Replace('/', '_');
                    int luaPos = fileName.LastIndexOf('/');
                    if (luaPos > 0)
                    {
                        fileName = fileName.Substring(luaPos + 1);
                    }
                }

                if (!fileName.EndsWith(".lua"))
                {
                    fileName += ".lua";
                }

#if UNITY_5 || UNITY_2017
                fileName += ".bytes";
#endif
                zipName = sb.ToString();
                zipMap.TryGetValue(zipName, out zipFile);
            }

            if (zipFile != null)
            {
#if UNITY_5 || UNITY_2017
                TextAsset luaCode = zipFile.LoadAsset <TextAsset>(fileName);
#else
                TextAsset luaCode = zipFile.Load(fileName, typeof(TextAsset)) as TextAsset;
#endif

                if (luaCode != null)
                {
                    buffer = luaCode.bytes;
                    Resources.UnloadAsset(luaCode);
                }
            }

            return(buffer);
        }
Ejemplo n.º 8
0
        byte[] ReadZipFile(string fileName)
        {
            AssetBundle zipFile = null;

            byte[] buffer  = null;
            string zipName = null;

            using (CString.Block())
            {
                //注意这里的操作,如果在lua脚本里面使用require引用模块
                //一定要加上路径,这个路径相对于AppConst里面的LuaTempDir目录
                //例如require "3rd/pbc/protobuf"
                CString sb = CString.Alloc(256);
                sb.Append("lua");
                int pos = fileName.LastIndexOf('/');

                if (pos > 0)
                {
                    sb.Append("_");
                    sb.Append(fileName, 0, pos).ToLower().Replace('/', '_');
                    fileName = fileName.Substring(pos + 1);
                }

                if (!fileName.EndsWith(".lua"))
                {
                    fileName += ".lua";
                }

#if UNITY_5 || UNITY_5_3_OR_NEWER
                fileName += ".bytes";
#endif
                zipName = sb.ToString();
                zipMap.TryGetValue(zipName, out zipFile);
            }

            if (zipFile != null)
            {
#if UNITY_4_6 || UNITY_4_7
                TextAsset luaCode = zipFile.Load(fileName, typeof(TextAsset)) as TextAsset;
#else
                TextAsset luaCode = zipFile.LoadAsset <TextAsset>(fileName);
#endif
                if (luaCode != null)
                {
                    buffer = luaCode.bytes;
                    Resources.UnloadAsset(luaCode);
                }
            }

            return(buffer);
        }
Ejemplo n.º 9
0
        byte[] ReadZipFile(string fileName)
        {
            AssetBundle zipFile = null;

            byte[] buffer  = null;
            string zipName = null;

            using (CString.Block())
            {
                CString sb = CString.Alloc(256);
                sb.Append("lua");
                int pos = fileName.LastIndexOf('/');

                if (pos > 0)
                {
                    sb.Append("_");
                    sb.Append(fileName, 0, pos).ToLower().Replace('/', '_');
                    fileName = fileName.Substring(pos + 1);
                }

                if (!fileName.EndsWith(".lua"))
                {
                    fileName += ".lua";
                }

#if UNITY_5 || UNITY_2017
                fileName += ".bytes";
#endif
                zipName = sb.ToString();
                zipName = "lua";  //本工程所有lua文件都打包到lua.lua.assetbundle中,与LuaFramework打包方式不同;
                zipMap.TryGetValue(zipName, out zipFile);
            }

            if (zipFile != null)
            {
#if UNITY_5 || UNITY_2017
                TextAsset luaCode = zipFile.LoadAsset <TextAsset>(fileName);
#else
                TextAsset luaCode = zipFile.Load(fileName, typeof(TextAsset)) as TextAsset;
#endif

                if (luaCode != null)
                {
                    Debug.Log(string.Format("[LuaFileUtils]=====>Loa Lua Code:{0} success.", fileName));
                    buffer = luaCode.bytes;
                    Resources.UnloadAsset(luaCode);
                }
            }

            return(buffer);
        }
Ejemplo n.º 10
0
        byte[] ReadZipFile(string fileName)
        {
            byte[] buffer  = null;
            string zipName = null;

            AssetBundle zipFile;

            using (CString.Block())
            {
                CString sb = CString.Alloc(256);
                sb.Append("lua");
                int pos = fileName.LastIndexOf('/');

                if (pos > 0)
                {
                    sb.Append("_");
                    sb.Append(fileName, 0, pos).ToLower().Replace('/', '_');
                    fileName = fileName.Substring(pos + 1);
                }

                if (!fileName.EndsWith(".lua", System.StringComparison.Ordinal))
                {
                    fileName += ".lua";
                }

#if UNITY_5 || UNITY_5_3_OR_NEWER
                fileName += ".bytes";
#endif
                zipName = sb.ToString();
                zipMap.TryGetValue(zipName, out zipFile);
            }

            if (zipFile != null)
            {
#if UNITY_4_6 || UNITY_4_7
                TextAsset luaCode = zipFile.Load(fileName, typeof(TextAsset)) as TextAsset;
#else
                TextAsset luaCode = zipFile.LoadAsset <TextAsset>(fileName);
#endif
                if (luaCode != null)
                {
                    buffer = luaCode.bytes;
                    Resources.UnloadAsset(luaCode);
                }
            }

            return(buffer);
        }
Ejemplo n.º 11
0
        //减少gc alloc
        static string GetLogFormat(string str)
        {
            var time = DateTime.Now;

            sb.Clear();
            sb.Append(ConstStringTable.GetTimeIntern(time.Year))
            .Append("-")
            .Append(ConstStringTable.GetTimeIntern(time.Month))
            .Append("-")
            .Append(ConstStringTable.GetTimeIntern(time.Day))
            .Append("-")
            .Append(ConstStringTable.GetTimeIntern(time.Hour))
            .Append(":")
            .Append(ConstStringTable.GetTimeIntern(time.Minute))
            .Append(":")
            .Append(ConstStringTable.GetTimeIntern(time.Second))
            .Append(".")
            .Append(time.Millisecond)
            .Append("-")
            .Append(Time.frameCount % 999)
            .Append(": ")
            .Append(str);

            var dest = StringPool.Alloc(sb.Length);

            sb.CopyToString(dest);
            return(dest);
        }
Ejemplo n.º 12
0
    // Token: 0x06001D36 RID: 7478 RVA: 0x003464D8 File Offset: 0x003446D8
    private void Create3DObjects()
    {
        if (this.NowHeroID == this.LastHeroID)
        {
            return;
        }
        if (this.LoadingStep > UIJailRoom.eModelLoadingStep.WaitforHero)
        {
            this.Destory3DObject(false);
        }
        if (this.LoadingStep == UIJailRoom.eModelLoadingStep.Start)
        {
            CString cstring = StringManager.Instance.StaticString1024();
            cstring.Append("Role/cage");
            this.bundle        = AssetManager.GetAssetBundle(cstring, out this.AssetKey1);
            this.bundleRequest = this.bundle.LoadAsync("m", typeof(GameObject));
            this.LoadingStep   = UIJailRoom.eModelLoadingStep.WaitforCage;
            return;
        }
        this.LastHeroID = this.NowHeroID;
        this.heroData   = DataManager.Instance.HeroTable.GetRecordByKey(this.NowHeroID);
        CString cstring2 = StringManager.Instance.StaticString1024();

        cstring2.IntToFormat((long)this.heroData.Modle, 5, false);
        cstring2.AppendFormat("Role/hero_{0}");
        this.bundle = AssetManager.GetAssetBundle(cstring2, out this.AssetKey2);
        if (this.bundle == null)
        {
            this.LoadingStep = UIJailRoom.eModelLoadingStep.Done;
            return;
        }
        this.bundleRequest = this.bundle.LoadAsync("m", typeof(GameObject));
        this.LoadingStep   = UIJailRoom.eModelLoadingStep.WaitforHero;
    }
Ejemplo n.º 13
0
    // Token: 0x060024E2 RID: 9442 RVA: 0x00424684 File Offset: 0x00422884
    public void InitialAB()
    {
        CString cstring = StringManager.Instance.StaticString1024();

        if (this.PicPackageID1 != 0)
        {
            cstring.IntToFormat((long)this.PicPackageID1, 1, false);
            cstring.AppendFormat("Store/Mallback_{0}");
        }
        else
        {
            cstring.Append("UI/Mall_0");
        }
        this.m_AssetBundle = AssetManager.GetAssetBundle(cstring, out this.m_AssetBundleKey);
        if (this.m_AssetBundle != null)
        {
            this.m_Material = (this.m_AssetBundle.Load("Mall_m", typeof(Material)) as Material);
            UnityEngine.Object[] array = this.m_AssetBundle.LoadAll(typeof(Sprite));
            for (int i = 0; i < array.Length; i++)
            {
                ushort num = ushort.Parse(array[i].name);
                if (num == 100)
                {
                    this.m_BackImage1 = (Sprite)array[i];
                }
                else if (num == 200)
                {
                    this.m_BackImage2 = (Sprite)array[i];
                }
            }
        }
    }
Ejemplo n.º 14
0
    // Token: 0x06000216 RID: 534 RVA: 0x0001D0C8 File Offset: 0x0001B2C8
    private void sendModifyBookMark_Alliance(byte ID, string Name)
    {
        if (DataManager.Instance.RoleAlliance.Id == 0u || DataManager.Instance.RoleAlliance.Rank < AllianceRank.RANK4)
        {
            GUIManager.Instance.AddHUDMessage(DataManager.Instance.mStringTable.GetStringByID(4753u), 255, true);
            return;
        }
        if (!GUIManager.Instance.ShowUILock(EUILock.BookMark))
        {
            return;
        }
        MessagePacket messagePacket = new MessagePacket(1024);

        messagePacket.Protocol = Protocol._MSG_REQUEST_ALLIANCE_MODIFYBOOKMARK;
        CString cstring = StringManager.Instance.StaticString1024();

        cstring.Append(Name);
        cstring.SetLength(cstring.Length);
        byte[] bytes = Encoding.UTF8.GetBytes(cstring.ToString());
        byte   b     = (byte)Math.Min(bytes.Length, (int)this.NameSize);

        cstring.SetLength(cstring.MaxLength);
        messagePacket.AddSeqId();
        messagePacket.Add(1);
        messagePacket.Add(ID -= 1);
        messagePacket.Add(b);
        messagePacket.Add(this.AllAllianceData[(int)ID].KingdomID);
        messagePacket.Add(this.AllAllianceData[(int)ID].KingdomPoint.zoneID);
        messagePacket.Add(this.AllAllianceData[(int)ID].KingdomPoint.pointID);
        messagePacket.Add(bytes, 0, (int)b);
        messagePacket.Send(false);
    }
Ejemplo n.º 15
0
    //public static CString ToCString(this System.Int16 number, string format, IFormatProvider provider)
    //{
    //    CString str = CString.Alloc(16);
    //    str.NumberToString(format, (int)number, provider);
    //    return str;
    //}

    public static CString ToCString(this System.UInt16 number)
    {
        CString str = CString.Alloc(8);

        str.Append(number);
        return(str);
    }
Ejemplo n.º 16
0
    public static unsafe CString SubStringEx(this string str, int startIndex)
    {
        if (startIndex < 0)
        {
            throw new ArgumentOutOfRangeException("startIndex", "Cannot be negative.");
        }

        if (startIndex > str.Length)
        {
            throw new ArgumentOutOfRangeException("startIndex", "Cannot exceed length of string.");
        }

        int len = str.Length - startIndex;

        if (len == 0)
        {
            return(CString.Alloc(0));
        }

        if (startIndex == 0 && len == str.Length)
        {
            return(str);
        }

        CString cstr = CString.Alloc(len);

        cstr.Append(str, startIndex, len);
        return(cstr);
    }
Ejemplo n.º 17
0
        //
        public virtual string FindFileError(string fileName)
        {
            if (Path.IsPathRooted(fileName))
            {
                return(fileName);
            }

            if (fileName.EndsWith(".lua"))
            {
                fileName = fileName.Substring(0, fileName.Length - 4);
            }

            using (CString.Block())
            {
                CString sb = CString.Alloc(512);

                for (int i = 0; i < searchPaths.Count; i++)
                {
                    sb.Append("\n\tno file '").Append(searchPaths[i]).Append('\'');
                }

                sb = sb.Replace("?", fileName);

                return(sb.ToString());
            }
        }
Ejemplo n.º 18
0
    //public static CString ToCString(this System.UInt32 number, string format, IFormatProvider provider)
    //{
    //    CString str = CString.Alloc(32);
    //    str.NumberToString(format, number, provider);
    //    return str;
    //}

    public static CString ToCString(this System.Int64 number)
    {
        CString str = CString.Alloc(32);

        str.Append(number);
        return(str);
    }
Ejemplo n.º 19
0
    //public static CString ToCString(this System.Single number, string format, IFormatProvider provider)
    //{
    //    CString str = CString.Alloc(64);
    //    str.NumberToString(format, number, provider);
    //    return str;
    //}

    public static CString ToCString(this System.Double number)
    {
        CString str = CString.Alloc(64);

        str.Append(number);
        return(str);
    }
Ejemplo n.º 20
0
    // Token: 0x06001339 RID: 4921 RVA: 0x00219EC8 File Offset: 0x002180C8
    public void CreateTopBoard()
    {
        this.SPHeight.Clear();
        this.SPHeight.Add(118f);
        this.SPHeight.Add(118f);
        this.SPHeight.Add(118f);
        this.SPHeight.Add(118f);
        this.AGS_Form.GetChild(3).gameObject.SetActive(false);
        RoleBuildingData buildData = GUIManager.Instance.BuildingData.GetBuildData(8, 0);

        this.AGS_Form.GetChild(12).gameObject.SetActive(false);
        UIKVKLBoard.isTopBoard = true;
        UIText component = this.AGS_Form.GetChild(1).GetChild(0).GetComponent <UIText>();

        component.text = DataManager.Instance.mStringTable.GetStringByID(9848u);
        this.AGS_Form.GetChild(2).gameObject.SetActive(true);
        this.AGS_Form.GetChild(5).gameObject.SetActive(true);
        component = this.AGS_Form.GetChild(5).GetComponent <UIText>();
        CString cstring  = StringManager.Instance.StaticString1024();
        CString cstring2 = StringManager.Instance.StaticString1024();

        cstring.ClearString();
        cstring.Append(GameConstants.GetDateTime(LeaderBoardManager.Instance.KvKTopBoard.SortTime).ToString("MM/dd/yy HH:mm"));
        cstring2.ClearString();
        cstring2.Append(GameConstants.GetDateTime(LeaderBoardManager.Instance.KvKTopBoard.SortTime + (long)((ulong)LeaderBoardManager.Instance.KvKTopBoard.KingdomEventRequireTime)).ToString("MM/dd/yy HH:mm"));
        this.Ranking.ClearString();
        this.Ranking.Append(DataManager.Instance.mStringTable.GetStringByID(8153u));
        this.Ranking.Append(" ");
        this.Ranking.Append(cstring);
        this.Ranking.Append(" ~ ");
        this.Ranking.Append(cstring2);
        component.text = this.Ranking.ToString();
        component.SetAllDirty();
        component.cachedTextGenerator.Invalidate();
    }
Ejemplo n.º 21
0
    // Token: 0x0600014B RID: 331 RVA: 0x000158D4 File Offset: 0x00013AD4
    private string GetKeyString(string str, int index, char keyEnd, byte bReserve = 0)
    {
        CString cstring  = StringManager.Instance.StaticString1024();
        CString cstring2 = StringManager.Instance.StaticString1024();

        while (index < str.Length)
        {
            if (str[index] == keyEnd)
            {
                break;
            }
            if (bReserve == 0)
            {
                cstring.Append(str[index]);
            }
            else
            {
                cstring2.ClearString();
                cstring2.Append(str[index]);
                cstring.Insert(0, cstring2, 1);
            }
            index++;
        }
        return(cstring.ToString());
    }
Ejemplo n.º 22
0
        // Token: 0x0600145A RID: 5210 RVA: 0x0023A17C File Offset: 0x0023837C
        public void Find(byte kind, ref int index, CString msg)
        {
            if (this.Size == 0)
            {
                index = -1;
                return;
            }
            byte size = this.Size;

            for (int i = index; i < this.Kind.Length; i++)
            {
                if (this.Kind[i] == kind)
                {
                    this.Kind[i] = byte.MaxValue;
                    this.Size   -= 1;
                    msg.ClearString();
                    msg.Append(this.Msg[i]);
                    break;
                }
            }
            if (size == this.Size)
            {
                index = -1;
            }
        }
Ejemplo n.º 23
0
        byte[] ReadZipFile(string fileName)
        {
            byte[] buffer  = null;
            string zipName = null;

            using (CString.Block())
            {
                CString sb = CString.Alloc(256);
                sb.Append("lua");
                int pos = fileName.LastIndexOf('/');

                if (pos > 0)
                {
                    sb.Append("_");
                    sb.Append(fileName, 0, pos).ToLower().Replace('/', '_');
                    fileName = fileName.Substring(pos + 1);
                }
                sb.Append("_");
                if (!fileName.EndsWith(".lua"))
                {
                    fileName += ".lua";
                }

#if UNITY_5 || UNITY_5_3_OR_NEWER
                //fileName += ".bytes";
#endif
                zipName = sb.ToString();
                Debug.LogWarning(string.Format("lua zip name:{0}  file:{1}", zipName, fileName.ToLower()));
            }

            foreach (var zipFile in zipMap.Values)
            {
                //string key = zipName + fileName.ToLower();
                //Debug.Log("key:" + key);
                //string luaName = luaNameMap[key];
                //Debug.Log("luaName:" + luaName);
                TextAsset luaCode = zipFile.LoadAsset <TextAsset>(luaNameMap[zipName + fileName.ToLower()]);
                if (luaCode != null)
                {
                    //Debug.Log(luaCode.text);
                    buffer = luaCode.bytes;
                    Resources.UnloadAsset(luaCode);
                    break;
                }
            }
            return(buffer);
        }
Ejemplo n.º 24
0
        byte[] ReadZipFile(string fileName)
        {
            AssetBundle zipFile = null;

            byte[] buffer      = null;
            string zipName     = null;
            string newFileName = null;

            using (CString.Block())
            {
                CString sb = CString.Alloc(256);
                sb.Append("lua.unity3d");

                newFileName = string.Format("assets/luatemp/{0}", fileName.ToLower());
                //int pos = fileName.LastIndexOf('/');

                //if (pos > 0)
                //{
                //    sb.Append("_");
                //    sb.Append(fileName, 0, pos).ToLower().Replace('/', '_');
                //    fileName = fileName.Substring(pos + 1);
                //}

                //if (!fileName.EndsWith(".lua"))
                //{
                //    fileName += ".lua";
                //}


                if (!newFileName.EndsWith(".lua"))
                {
                    newFileName += ".lua";
                }
#if UNITY_5 || UNITY_5_3_OR_NEWER
                // fileName += ".bytes";
                newFileName += ".bytes";
#endif
                zipName = sb.ToString();
                zipMap.TryGetValue(zipName, out zipFile);
            }

            if (zipFile != null)
            {
#if UNITY_4_6 || UNITY_4_7
                TextAsset luaCode = zipFile.Load(fileName, typeof(TextAsset)) as TextAsset;
#else
                //TextAsset luaCode = zipFile.LoadAsset<TextAsset>(fileName);
                TextAsset luaCode = zipFile.LoadAsset <TextAsset>(newFileName);
#endif
                if (luaCode != null)
                {
                    buffer = luaCode.bytes;
                    Resources.UnloadAsset(luaCode);
                }
            }

            return(buffer);
        }
Ejemplo n.º 25
0
    // Token: 0x06000211 RID: 529 RVA: 0x0001CCCC File Offset: 0x0001AECC
    private void sendAddBookMark_Alliance(string Name, ushort KingdomID, int MapPointID)
    {
        StringTable mStringTable = DataManager.Instance.mStringTable;
        DataManager instance     = DataManager.Instance;

        if (instance.RoleAlliance.Id == 0u || instance.RoleAlliance.Rank < AllianceRank.RANK4)
        {
            GUIManager.Instance.AddHUDMessage(mStringTable.GetStringByID(4753u), 255, true);
            return;
        }
        ushort num = this.GetBookMarkID(MapPointID, KingdomID, BookMark.eBookType.Alliance);

        if (num > 0)
        {
            ushort num2 = num;
            num = num2 - 1;
            this.OverWriteID   = num2;
            this.OverWriteType = 3;
            this.OverWriteName = Name;
            this.MessageStr.ClearString();
            this.MessageStr.StringToFormat(this.AllAllianceData[(int)num].Name);
            this.MessageStr.AppendFormat(mStringTable.GetStringByID(12633u));
            GUIManager.Instance.OpenOKCancelBox(5, mStringTable.GetStringByID(12632u), this.MessageStr.ToString(), 0, 0, mStringTable.GetStringByID(4599u), null);
            return;
        }
        if (this.AllianceBookCount == 20)
        {
            GUIManager.Instance.OpenMessageBox(mStringTable.GetStringByID(4826u), mStringTable.GetStringByID(12634u), null, null, 0, 0, false, false, false, false, false);
            return;
        }
        if (!GUIManager.Instance.ShowUILock(EUILock.BookMark))
        {
            return;
        }
        MessagePacket messagePacket = new MessagePacket(1024);

        messagePacket.Protocol = Protocol._MSG_REQUEST_ALLIANCE_MODIFYBOOKMARK;
        PointCode pointCode;

        GameConstants.MapIDToPointCode(MapPointID, out pointCode.zoneID, out pointCode.pointID);
        CString cstring = StringManager.Instance.StaticString1024();

        cstring.Append(Name);
        cstring.SetLength(cstring.Length);
        byte[] bytes = Encoding.UTF8.GetBytes(cstring.ToString());
        byte   b     = (byte)Math.Min(bytes.Length, (int)this.NameSize);

        cstring.SetLength(cstring.MaxLength);
        messagePacket.AddSeqId();
        messagePacket.Add(0);
        messagePacket.Add((byte)(this.GetEmptyID(BookMark.eBookType.Alliance) - 1));
        messagePacket.Add(b);
        messagePacket.Add(KingdomID);
        messagePacket.Add(pointCode.zoneID);
        messagePacket.Add(pointCode.pointID);
        messagePacket.Add(bytes, 0, (int)b);
        messagePacket.Send(false);
    }
Ejemplo n.º 26
0
 // Token: 0x060005BB RID: 1467 RVA: 0x0007F268 File Offset: 0x0007D468
 public void EmojiCenterIni()
 {
     if (this.EmojiAB == null)
     {
         GameObject gameObject = new GameObject("EmojiCenter");
         this.EmojiCenterLayout = gameObject.transform;
         gameObject             = new GameObject("EmojiSprites");
         this.EmojiSpriteLayout = gameObject.transform;
         this.EmojiSpriteLayout.SetParent(this.EmojiCenterLayout, false);
         gameObject           = new GameObject("ImagePool");
         this.ImagePoolLayout = gameObject.transform;
         this.ImagePoolLayout.SetParent(this.EmojiCenterLayout, false);
         gameObject = new GameObject("SpriteRendererPool");
         this.SpriteRendererPoolLayout = gameObject.transform;
         this.SpriteRendererPoolLayout.SetParent(this.EmojiCenterLayout, false);
         CString cstring = StringManager.Instance.SpawnString(30);
         cstring.ClearString();
         cstring.Append("UI/Map_NPC_Blood");
         this.EmojiAB = AssetManager.GetAssetBundle(cstring, out this.EmojiABKey);
         for (ushort num = 0; num < 8; num += 1)
         {
             this.AddEmojiSprite(num);
         }
         this.AddEmojiSprite(ushort.MaxValue);
         Image component = this.EmojiSpriteLayout.GetChild(0).GetComponent <Image>();
         this.basesize = (float)DataManager.MapDataController.EmojiDataTable.GetRecordByKey(1).sizeX;
         if (this.basesize == 0f)
         {
             this.basesize = 60f;
         }
         this.EmojiImageMaterial                      = component.material;
         this.EmojiSpriteRendererMaterial             = new Material(this.EmojiImageMaterial);
         this.EmojiSpriteRendererMaterial.renderQueue = 2665;
         RectTransform rectTransform = this.EmojiSpriteLayout.GetChild(this.EmojiSpriteLayout.childCount - 1) as RectTransform;
         this.basebacksize = rectTransform.sizeDelta.x;
         if (this.basebacksize < rectTransform.sizeDelta.y)
         {
             this.basebacksize = rectTransform.sizeDelta.y;
         }
         if (this.basebacksize == 0f)
         {
             this.basebacksize = 73f;
         }
         this.basebackoffset = this.basebacksize - this.basesize * 0.9f;
     }
     if (this.ImagePoolLayout == null)
     {
         GameObject gameObject2 = new GameObject("ImagePool");
         this.ImagePoolLayout = gameObject2.transform;
         this.ImagePoolLayout.SetParent(this.EmojiCenterLayout, false);
     }
     if (this.SpriteRendererPoolLayout == null)
     {
         GameObject gameObject3 = new GameObject("SpriteRendererPool");
         this.SpriteRendererPoolLayout = gameObject3.transform;
         this.SpriteRendererPoolLayout.SetParent(this.EmojiCenterLayout, false);
     }
 }
Ejemplo n.º 27
0
    // Token: 0x06000210 RID: 528 RVA: 0x0001CABC File Offset: 0x0001ACBC
    public void sendAddBookMark(string Name, byte Type, ushort KingdomID, int MapPointID)
    {
        if (Type == 3)
        {
            this.sendAddBookMark_Alliance(Name, KingdomID, MapPointID);
            return;
        }
        StringTable mStringTable = DataManager.Instance.mStringTable;
        DataManager instance     = DataManager.Instance;

        if (this.UpdateTime == 0L || instance.RoleAttr.BookmarkTime != this.UpdateTime || this.RecvDataCount > 0)
        {
            GUIManager.Instance.AddHUDMessage(mStringTable.GetStringByID(8459u), 255, true);
            return;
        }
        ushort num = this.GetBookMarkID(MapPointID, KingdomID, BookMark.eBookType.Role);

        if (num > 0)
        {
            ushort num2 = num;
            num = num2 - 1;
            this.OverWriteID   = num2;
            this.OverWriteType = Type;
            this.OverWriteName = Name;
            this.MessageStr.ClearString();
            this.MessageStr.StringToFormat(this.AllData[(int)num].Name);
            this.MessageStr.AppendFormat(mStringTable.GetStringByID(4598u));
            GUIManager.Instance.OpenOKCancelBox(5, mStringTable.GetStringByID(4518u), this.MessageStr.ToString(), 0, 0, mStringTable.GetStringByID(4599u), null);
            return;
        }
        if (instance.RoleAttr.BookmarkNum == instance.RoleAttr.BookmarkLimit)
        {
            GUIManager.Instance.OpenMessageBox(mStringTable.GetStringByID(614u), mStringTable.GetStringByID(642u), mStringTable.GetStringByID(3u), null, 0, 0, false, false, false, false, false);
            return;
        }
        if (!GUIManager.Instance.ShowUILock(EUILock.BookMark))
        {
            return;
        }
        MessagePacket messagePacket = new MessagePacket(1024);

        messagePacket.Protocol = Protocol._MSG_REQUEST_NEWBOOKMARK;
        PointCode pointCode;

        GameConstants.MapIDToPointCode(MapPointID, out pointCode.zoneID, out pointCode.pointID);
        CString cstring = StringManager.Instance.StaticString1024();

        cstring.Append(Name);
        messagePacket.AddSeqId();
        messagePacket.Add(this.GetEmptyID(BookMark.eBookType.Role));
        messagePacket.Add(Type);
        messagePacket.Add(KingdomID);
        messagePacket.Add(pointCode.zoneID);
        messagePacket.Add(pointCode.pointID);
        messagePacket.Add(Encoding.UTF8.GetBytes(cstring.ToString()), 0, (int)this.NameSize);
        messagePacket.Send(false);
    }
Ejemplo n.º 28
0
        public virtual string FindFileError(string fileName)
        {
            Debug.LogError("不应该走到这里了");
            if (Path.IsPathRooted(fileName))
            {
                return(fileName);
            }

            if (fileName.EndsWith(".lua"))
            {
                fileName = fileName.Substring(0, fileName.Length - 4);
            }

            using (CString.Block())
            {
                CString sb = CString.Alloc(512);

                for (int i = 0; i < searchPaths.Count; i++)
                {
                    sb.Append("\n\tno Other file '").Append(searchPaths[i]).Append('\'');
                }

                sb = sb.Replace("?", fileName);

                if (beZip)
                {
                    int pos = fileName.LastIndexOf('/');

                    if (pos > 0)
                    {
                        int tmp = pos + 1;
                        sb.Append("\n\tno file '").Append(fileName, tmp, fileName.Length - tmp).Append(".lua' in ").Append("lua_");
                        tmp = sb.Length;
                        sb.Append(fileName, 0, pos).Replace('/', '_', tmp, pos).Append(".unity3d");
                    }
                    else
                    {
                        sb.Append("\n\tno file '").Append(fileName).Append(".lua' in ").Append("lua.unity3d");
                    }
                }

                return(sb.ToString());
            }
        }
Ejemplo n.º 29
0
 // Token: 0x06000E6E RID: 3694 RVA: 0x0017C364 File Offset: 0x0017A564
 public void OnButtonClick(UIButton sender)
 {
     if (sender.m_BtnID1 == 21)
     {
         if (this.Type == ECaseByCaseType.ECBCT_SaveTalent)
         {
             CString cstring = StringManager.Instance.StaticString1024();
             this.m_input.text.Trim();
             cstring.Append(this.m_input.text);
             DataManager.Instance.SaveTalentData[0].SetTagName(cstring);
             GUIManager.Instance.UpdateUI(EGUIWindow.UI_Talent, -2, 0);
             GUIManager.Instance.CloseMenu(this.m_eWindow);
             return;
         }
         if (this.Type == ECaseByCaseType.ECBCT_EquipMemorySetup)
         {
             this.m_input.text.Trim();
             UILordEquipSetEdit.showingSet.Name.ClearString();
             UILordEquipSetEdit.showingSet.Name.Append(this.m_input.text);
             UILordEquipSetEdit.ThingsChanged = true;
             GUIManager.Instance.UpdateUI(EGUIWindow.UI_LordEquipSetEdit, 1, 0);
             GUIManager.Instance.CloseMenu(this.m_eWindow);
             return;
         }
         if (this.Type == ECaseByCaseType.ECBCT_Preselectedteam)
         {
             this.m_input.text.Trim();
             DataManager.Instance.TeamName.ClearString();
             DataManager.Instance.TeamName.Append(this.m_input.text);
             GUIManager.Instance.UpdateUI(EGUIWindow.UI_Expedition, 3, 0);
             GUIManager.Instance.CloseMenu(this.m_eWindow);
             return;
         }
         if (this.Type >= ECaseByCaseType.ECBCT_ReNickName)
         {
             this.OnCheck(this.m_input.text);
         }
         if (this.CheckTime > 0f || this.Tick.activeSelf)
         {
             this.Congrats(this.m_input.text.Trim());
         }
     }
     else
     {
         if (this.Type == ECaseByCaseType.ECBCT_Rename)
         {
             string text = this.DM.RoleAttr.Name.ToString();
             if (text.Substring(0, 3) == "ID." && NewbieManager.bShowRenameMessage)
             {
                 GUIManager.Instance.AddHUDMessage(this.DM.mStringTable.GetStringByID(8055u), 255, true);
             }
             NewbieManager.bShowRenameMessage = false;
         }
         GUIManager.Instance.CloseMenu(this.m_eWindow);
     }
 }
Ejemplo n.º 30
0
        /// <summary>
        /// 错误日志
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public string FindFileError(string fileName)
        {
            if (Path.IsPathRooted(fileName))
            {
                return(fileName);
            }

            if (fileName.EndsWith(".lua"))
            {
                fileName = fileName.Substring(0, fileName.Length - 4);
            }

            using (CString.Block())
            {
                CString sb = CString.Alloc(512);

                for (int i = 0; i < luaSearchPath.Count; i++)
                {
                    sb.Append("\n\tMoon no file '").Append(luaSearchPath[i]).Append('\'');
                }

                sb = sb.Replace("?", fileName);

                if (AppConst.LuaBundleMode)
                {
                    int pos = fileName.LastIndexOf('/');

                    if (pos > 0)
                    {
                        int tmp = pos + 1;
                        sb.Append("\n\tMoon no file '").Append(fileName, tmp, fileName.Length - tmp).Append(".lua' in ").Append("lua_");
                        tmp = sb.Length;
                        sb.Append(fileName, 0, pos).Replace('/', '_', tmp, pos).Append(".unity3d");
                    }
                    else
                    {
                        sb.Append("\n\tMoon no file '").Append(fileName).Append(" in ").Append("lua.unity3d");
                    }
                }

                return(sb.ToString());
            }
        }