Пример #1
0
    public static IEnumerator PostScore(GameConstants.GameMode gameMode, string name, int score, bool loadScoreboard)
    {
        name = name.Trim();
        name = name.Replace("小雞雞", "帥哥");

        string postScoreUrl;
        if (gameMode == GameConstants.GameMode.SURVIVAL_NORMAL) {
          postScoreUrl = "http://www.tobygameac.com/NanoTD/postSurvivalNormalScore.php";
        } else {
          yield break;
        }

        string hash = Md5Sum(name + score.ToString() + secretKey);

        string realPostScoreUrl = postScoreUrl + "?name=" + WWW.EscapeURL(name) + "&score=" + score.ToString() + "&hash=" + hash;

        WWW hs_post = new WWW(realPostScoreUrl);
        yield return hs_post;
        if (hs_post.error != null) {
          print("There was an error posting the score: " + hs_post.error);
        }

        if (loadScoreboard) {
          Application.LoadLevel("Scoreboard");
        }
    }
Пример #2
0
 public Technology(GameConstants.TechnologyID id, int cost, bool repeatable = false, GameConstants.TechnologyID[] requiredTechnology = null)
 {
     _id = id;
     _name = GameConstants.NameOfTechnologyID[(int)id];
     _cost = cost;
     _repeatable = repeatable;
     _requiredTechnology = requiredTechnology;
 }
Пример #3
0
 public Item(GameConstants.ItemType type, int count)
 {
     this.type = type;
     if (count > 0){
         this.count = count;
     }
     else {
         this.count = 0;
     }
 }
Пример #4
0
 public Prize GetPrize(GameConstants.eBabies _babyType)
 {
     foreach(Prize prize in prizes)
     {
         if(prize.foodType == _babyType && prize.transform.parent == transform)
         {
             prize.gameObject.SetActive(true);
             return prize;
         }
     }
     return null;
 }
Пример #5
0
 public void addItemToCart(GameConstants.ItemType type)
 {
     for(int i =0; i< cartItems.Count; i++){
         if(cartItems[i].getType () == type){
             cartItems[i].incrementCount();
             renderCartItemList ();
             return;
         }
     }
     cartItems.Add (new Item (type, 1));
     renderCartItemList ();
 }
Пример #6
0
 public Baby GetBaby(GameConstants.eBabies _babyType)
 {
     foreach(Baby baby in babies)
     {
         if(baby.baby == _babyType && baby.transform.parent == transform)
         {
             baby.gameObject.SetActive(true);
             return baby;
         }
     }
     return null;
 }
Пример #7
0
 public Food GetFood(GameConstants.eBabies _babyType)
 {
     foreach(Food f in food)
     {
         if(f.foodType == _babyType && f.transform.parent == transform)
         {
             f.gameObject.SetActive(true);
             return f;
         }
     }
     return null;
 }
Пример #8
0
    public static IEnumerator GetScores(GameConstants.GameMode gameMode)
    {
        isGettingScores = true;

        string scoreboardUrl;
        if (gameMode == GameConstants.GameMode.SURVIVAL_NORMAL) {
          scoreboardUrl = "http://www.tobygameac.com/NanoTD/SurvivalNormalScoreboard.php";
        } else {
          yield break;
        }

        WWW scoreboardWWW = new WWW(scoreboardUrl);
        yield return scoreboardWWW;

        scoreboardText = scoreboardWWW.text;

        isGettingScores = false;
    }
Пример #9
0
 public override string UI_GetInfo()
 {
     return(Localization.GetWord(LocalizedWord.Effectiveness) + ": " + ((int)(GetLabourCoefficient() * GameConstants.GetWorkComplexityCf(WorkType.OpenFarming))).ToString() + '%');
 }
Пример #10
0
        public static void Align(
            FilePath inputPath,
            FilePath outputPath,
            GameMode gameMode,
            AlignmentRules alignmentRules,
            TempFolder?temp = null)
        {
            var interest = new RecordInterest(alignmentRules.Alignments.Keys)
            {
                EmptyMeansInterested = false
            };
            var parsingBundle = new ParsingBundle(GameConstants.Get(gameMode));
            var fileLocs      = RecordLocator.GetFileLocations(inputPath.Path, gameMode, interest);

            temp ??= new TempFolder();
            using (temp)
            {
                var alignedMajorRecordsFile = Path.Combine(temp.Dir.Path, "alignedRules");
                using (var inputStream = new MutagenBinaryReadStream(inputPath.Path, parsingBundle))
                {
                    using var writer = new MutagenWriter(new FileStream(alignedMajorRecordsFile, FileMode.Create), gameMode);
                    AlignMajorRecordsByRules(inputStream, writer, alignmentRules, fileLocs);
                }

                var alignedGroupsFile = Path.Combine(temp.Dir.Path, "alignedGroups");
                using (var inputStream = new MutagenBinaryReadStream(alignedMajorRecordsFile, parsingBundle))
                {
                    using var writer = new MutagenWriter(new FileStream(alignedGroupsFile, FileMode.Create), gameMode);
                    AlignGroupsByRules(inputStream, writer, alignmentRules, fileLocs);
                }

                fileLocs = RecordLocator.GetFileLocations(alignedGroupsFile, gameMode, interest);
                var alignedCellsFile = Path.Combine(temp.Dir.Path, "alignedCells");
                using (var mutaReader = new BinaryReadStream(alignedGroupsFile))
                {
                    using var writer = new MutagenWriter(alignedCellsFile, gameMode);
                    foreach (var grup in fileLocs.GrupLocations)
                    {
                        if (grup <= mutaReader.Position)
                        {
                            continue;
                        }
                        var noRecordLength = grup - mutaReader.Position;
                        mutaReader.WriteTo(writer.BaseStream, (int)noRecordLength);

                        // If complete overall, return
                        if (mutaReader.Complete)
                        {
                            break;
                        }

                        mutaReader.WriteTo(writer.BaseStream, 12);
                        var grupType = (GroupTypeEnum)mutaReader.ReadUInt32();
                        writer.Write((int)grupType);
                        switch (grupType)
                        {
                        case GroupTypeEnum.CellChildren:
                            AlignCellChildren(mutaReader, writer);
                            break;

                        default:
                            break;
                        }
                    }
                    mutaReader.WriteTo(writer.BaseStream, checked ((int)mutaReader.Remaining));
                }

                fileLocs = RecordLocator.GetFileLocations(alignedCellsFile, gameMode, interest);
                using (var mutaReader = new MutagenBinaryReadStream(alignedCellsFile, parsingBundle))
                {
                    using var writer = new MutagenWriter(outputPath.Path, GameConstants.Get(gameMode));
                    foreach (var grup in fileLocs.GrupLocations)
                    {
                        if (grup <= mutaReader.Position)
                        {
                            continue;
                        }
                        var noRecordLength = grup - mutaReader.Position;
                        mutaReader.WriteTo(writer.BaseStream, (int)noRecordLength);

                        // If complete overall, return
                        if (mutaReader.Complete)
                        {
                            break;
                        }

                        mutaReader.WriteTo(writer.BaseStream, 12);
                        var grupType = (GroupTypeEnum)mutaReader.ReadUInt32();
                        writer.Write((int)grupType);
                        switch (grupType)
                        {
                        case GroupTypeEnum.WorldChildren:
                            AlignWorldChildren(mutaReader, writer);
                            break;

                        default:
                            break;
                        }
                    }
                    mutaReader.WriteTo(writer.BaseStream, checked ((int)mutaReader.Remaining));
                }
            }
        }
Пример #11
0
    // Token: 0x06001DA3 RID: 7587 RVA: 0x0036EA48 File Offset: 0x0036CC48
    public void UpDateRowItem(GameObject item, int dataIdx, int panelObjectIdx, int panelId)
    {
        if (dataIdx > 0)
        {
            this.tmpCR = this.DM.ResourceReportGet(this.mResourcesMax - dataIdx);
        }
        if (this.ItemT[panelObjectIdx] == null)
        {
            this.ItemT[panelObjectIdx]                      = item.GetComponent <Transform>();
            this.mScrollItem[panelObjectIdx]                = item.GetComponent <ScrollPanelItem>();
            this.Itme_PT1[panelObjectIdx]                   = this.ItemT[panelObjectIdx].GetChild(0);
            this.Itme_PT2[panelObjectIdx]                   = this.ItemT[panelObjectIdx].GetChild(1);
            this.Img_ItemTitle[panelObjectIdx]              = this.Itme_PT2[panelObjectIdx].GetChild(0).GetComponent <Image>();
            this.Img_ItemNew[panelObjectIdx]                = this.Itme_PT2[panelObjectIdx].GetChild(0).GetChild(0).GetComponent <Image>();
            this.text_ItemNew[panelObjectIdx]               = this.Itme_PT2[panelObjectIdx].GetChild(0).GetChild(0).GetChild(0).GetComponent <UIText>();
            this.text_ItemTitle[panelObjectIdx]             = this.Itme_PT2[panelObjectIdx].GetChild(0).GetChild(1).GetComponent <UIText>();
            this.Item_textTitleT[panelObjectIdx]            = this.Itme_PT2[panelObjectIdx].GetChild(0).GetChild(1).GetComponent <RectTransform>();
            this.text_ItemTime[panelObjectIdx]              = this.Itme_PT2[panelObjectIdx].GetChild(0).GetChild(2).GetComponent <UIText>();
            this.text_ItemTitle2[panelObjectIdx]            = this.Itme_PT2[panelObjectIdx].GetChild(0).GetChild(3).GetComponent <UIText>();
            this.btn_Hero_Porfile[panelObjectIdx]           = this.Itme_PT2[panelObjectIdx].GetChild(0).GetChild(4).GetComponent <UIButton>();
            this.btn_Hero_Porfile[panelObjectIdx].m_Handler = this;
            this.btn_Hero_Porfile[panelObjectIdx].m_BtnID2  = this.mResourcesMax - dataIdx;
            this.Item_btnPorfileT[panelObjectIdx]           = this.Itme_PT2[panelObjectIdx].GetChild(0).GetChild(4).GetComponent <RectTransform>();
            this.Img_ItemPorfile[panelObjectIdx]            = this.Itme_PT2[panelObjectIdx].GetChild(0).GetChild(4).GetChild(0).GetComponent <Image>();
            this.text_ItemPorfile[panelObjectIdx]           = this.Itme_PT2[panelObjectIdx].GetChild(0).GetChild(4).GetChild(1).GetComponent <UIText>();
            this.Img_ItemBG[panelObjectIdx]                 = this.Itme_PT2[panelObjectIdx].GetChild(1).GetComponent <Image>();
            this.ItemResT[panelObjectIdx]                   = this.Itme_PT2[panelObjectIdx].GetChild(1).GetChild(0);
            this.text_ItemRes_1[panelObjectIdx]             = this.ItemResT[panelObjectIdx].GetChild(0).GetChild(0).GetComponent <UIText>();
            this.text_ItemRes_2[panelObjectIdx]             = this.ItemResT[panelObjectIdx].GetChild(1).GetChild(0).GetComponent <UIText>();
            this.text_ItemRes_3[panelObjectIdx]             = this.ItemResT[panelObjectIdx].GetChild(2).GetChild(0).GetComponent <UIText>();
            this.text_ItemRes_4[panelObjectIdx]             = this.ItemResT[panelObjectIdx].GetChild(3).GetChild(0).GetComponent <UIText>();
            this.text_ItemRes_5[panelObjectIdx]             = this.ItemResT[panelObjectIdx].GetChild(4).GetChild(0).GetComponent <UIText>();
            this.text_Item[panelObjectIdx]                  = this.Itme_PT2[panelObjectIdx].GetChild(1).GetChild(1).GetComponent <UIText>();
            this.Img_ItemIcon1[panelObjectIdx]              = this.Itme_PT2[panelObjectIdx].GetChild(2).GetChild(0).GetComponent <Image>();
            this.Img_ItemIcon2[panelObjectIdx]              = this.Itme_PT2[panelObjectIdx].GetChild(2).GetChild(1).GetComponent <Image>();
            this.Img_ItemIcon3[panelObjectIdx]              = this.Itme_PT2[panelObjectIdx].GetChild(2).GetChild(2).GetComponent <Image>();
            if (dataIdx == 0)
            {
                this.Itme_PT1[panelObjectIdx].gameObject.SetActive(true);
            }
            else
            {
                this.Itme_PT2[panelObjectIdx].gameObject.SetActive(true);
                if (this.tmpCR != null)
                {
                    this.SetItemIcon(panelObjectIdx, (int)this.tmpCR.Resource.Result, true);
                }
                if (this.UnReadNum >= dataIdx)
                {
                    this.Img_ItemNew[panelObjectIdx].gameObject.SetActive(true);
                }
            }
        }
        else
        {
            this.btn_Hero_Porfile[panelObjectIdx].m_BtnID2 = this.mResourcesMax - dataIdx;
            if (dataIdx == 0)
            {
                this.Itme_PT1[panelObjectIdx].gameObject.SetActive(true);
                this.Itme_PT2[panelObjectIdx].gameObject.SetActive(false);
            }
            else
            {
                this.Itme_PT1[panelObjectIdx].gameObject.SetActive(false);
                this.Itme_PT2[panelObjectIdx].gameObject.SetActive(true);
                this.SetItemIcon(panelObjectIdx, this.mScrollItem[panelObjectIdx].m_BtnID2, false);
                if (this.tmpCR != null)
                {
                    this.SetItemIcon(panelObjectIdx, (int)this.tmpCR.Resource.Result, true);
                }
            }
        }
        if (dataIdx > 0)
        {
            if (this.UnReadNum >= dataIdx)
            {
                this.Item_textTitleT[panelObjectIdx].anchoredPosition = this.text_ItemTitle[panelObjectIdx].ArabicFixPos(new Vector2(121f, this.Item_textTitleT[panelObjectIdx].anchoredPosition.y));
                this.Img_ItemNew[panelObjectIdx].gameObject.SetActive(true);
            }
            else
            {
                this.Item_textTitleT[panelObjectIdx].anchoredPosition = this.text_ItemTitle[panelObjectIdx].ArabicFixPos(new Vector2(39f, this.Item_textTitleT[panelObjectIdx].anchoredPosition.y));
                this.Img_ItemNew[panelObjectIdx].gameObject.SetActive(false);
            }
            if (this.tmpCR != null)
            {
                this.Cstr_ItemName[panelObjectIdx].ClearString();
                this.Cstr_ItemName[panelObjectIdx].Append(this.tmpCR.Resource.Name);
                this.Cstr_ItemTitle[panelObjectIdx].ClearString();
                this.text_ItemTitle2[panelObjectIdx].gameObject.SetActive(false);
                switch (this.tmpCR.Resource.Result)
                {
                case 0:
                    this.Cstr_ItemTitle[panelObjectIdx].Append(this.DM.mStringTable.GetStringByID(12084u));
                    break;

                case 1:
                    this.Cstr_ItemTitle[panelObjectIdx].Append(this.DM.mStringTable.GetStringByID(12085u));
                    break;

                case 2:
                    this.Cstr_ItemTitle[panelObjectIdx].Append(this.DM.mStringTable.GetStringByID(12082u));
                    break;
                }
                this.text_ItemTitle[panelObjectIdx].text = this.Cstr_ItemTitle[panelObjectIdx].ToString();
                this.text_ItemTitle[panelObjectIdx].SetAllDirty();
                this.text_ItemTitle[panelObjectIdx].cachedTextGenerator.Invalidate();
                this.text_ItemTitle[panelObjectIdx].cachedTextGeneratorForLayout.Invalidate();
                this.text_ItemPorfile[panelObjectIdx].text = this.Cstr_ItemName[panelObjectIdx].ToString();
                this.text_ItemPorfile[panelObjectIdx].SetAllDirty();
                this.text_ItemPorfile[panelObjectIdx].cachedTextGenerator.Invalidate();
                this.text_ItemPorfile[panelObjectIdx].cachedTextGeneratorForLayout.Invalidate();
                this.text_ItemPorfile[panelObjectIdx].rectTransform.sizeDelta = new Vector2(this.text_ItemPorfile[panelObjectIdx].preferredWidth + 1f, this.text_ItemPorfile[panelObjectIdx].rectTransform.sizeDelta.y);
                if (this.GUIM.IsArabic)
                {
                    this.text_ItemPorfile[panelObjectIdx].UpdateArabicPos();
                }
                this.Item_btnPorfileT[panelObjectIdx].sizeDelta = new Vector2(this.text_ItemPorfile[panelObjectIdx].preferredWidth + 1f, this.Item_btnPorfileT[panelObjectIdx].sizeDelta.y);
                this.Img_ItemPorfile[panelObjectIdx].rectTransform.sizeDelta = new Vector2(this.text_ItemPorfile[panelObjectIdx].preferredWidth + 1f, this.Img_ItemPorfile[panelObjectIdx].rectTransform.sizeDelta.y);
                if (this.GUIM.IsArabic && this.text_ItemTitle[panelObjectIdx].rectTransform.localScale.x == -1f)
                {
                    this.Item_btnPorfileT[panelObjectIdx].anchoredPosition = new Vector2(this.text_ItemTitle[panelObjectIdx].rectTransform.anchoredPosition.x - this.text_ItemTitle[panelObjectIdx].rectTransform.sizeDelta.x + this.text_ItemTitle[panelObjectIdx].preferredWidth + 1f, this.Item_btnPorfileT[panelObjectIdx].anchoredPosition.y);
                }
                else
                {
                    this.Item_btnPorfileT[panelObjectIdx].anchoredPosition = new Vector2(this.text_ItemTitle[panelObjectIdx].rectTransform.anchoredPosition.x + this.text_ItemTitle[panelObjectIdx].preferredWidth + 1f, this.Item_btnPorfileT[panelObjectIdx].anchoredPosition.y);
                }
                this.text_ItemTime[panelObjectIdx].text = GameConstants.GetDateTime(this.tmpCR.Times).ToString("MM/dd/yy HH:mm:ss");
                this.text_ItemTime[panelObjectIdx].SetAllDirty();
                this.text_ItemTime[panelObjectIdx].cachedTextGenerator.Invalidate();
                if (this.tmpCR.Resource.Result < 2)
                {
                    this.Cstr_ItemRes_1[panelObjectIdx].ClearString();
                    GameConstants.FormatResourceValue(this.Cstr_ItemRes_1[panelObjectIdx], this.tmpCR.Resource.Resource[0]);
                    this.text_ItemRes_1[panelObjectIdx].text = this.Cstr_ItemRes_1[panelObjectIdx].ToString();
                    this.text_ItemRes_1[panelObjectIdx].SetAllDirty();
                    this.text_ItemRes_1[panelObjectIdx].cachedTextGenerator.Invalidate();
                    this.Cstr_ItemRes_2[panelObjectIdx].ClearString();
                    GameConstants.FormatResourceValue(this.Cstr_ItemRes_2[panelObjectIdx], this.tmpCR.Resource.Resource[1]);
                    this.text_ItemRes_2[panelObjectIdx].text = this.Cstr_ItemRes_2[panelObjectIdx].ToString();
                    this.text_ItemRes_2[panelObjectIdx].SetAllDirty();
                    this.text_ItemRes_2[panelObjectIdx].cachedTextGenerator.Invalidate();
                    this.Cstr_ItemRes_3[panelObjectIdx].ClearString();
                    GameConstants.FormatResourceValue(this.Cstr_ItemRes_3[panelObjectIdx], this.tmpCR.Resource.Resource[2]);
                    this.text_ItemRes_3[panelObjectIdx].text = this.Cstr_ItemRes_3[panelObjectIdx].ToString();
                    this.text_ItemRes_3[panelObjectIdx].SetAllDirty();
                    this.text_ItemRes_3[panelObjectIdx].cachedTextGenerator.Invalidate();
                    this.Cstr_ItemRes_4[panelObjectIdx].ClearString();
                    GameConstants.FormatResourceValue(this.Cstr_ItemRes_4[panelObjectIdx], this.tmpCR.Resource.Resource[3]);
                    this.text_ItemRes_4[panelObjectIdx].text = this.Cstr_ItemRes_4[panelObjectIdx].ToString();
                    this.text_ItemRes_4[panelObjectIdx].SetAllDirty();
                    this.text_ItemRes_4[panelObjectIdx].cachedTextGenerator.Invalidate();
                    this.Cstr_ItemRes_5[panelObjectIdx].ClearString();
                    GameConstants.FormatResourceValue(this.Cstr_ItemRes_5[panelObjectIdx], this.tmpCR.Resource.Resource[4]);
                    this.text_ItemRes_5[panelObjectIdx].text = this.Cstr_ItemRes_5[panelObjectIdx].ToString();
                    this.text_ItemRes_5[panelObjectIdx].SetAllDirty();
                    this.text_ItemRes_5[panelObjectIdx].cachedTextGenerator.Invalidate();
                    this.ItemResT[panelObjectIdx].gameObject.SetActive(true);
                    this.text_Item[panelObjectIdx].gameObject.SetActive(false);
                }
                else
                {
                    this.ItemResT[panelObjectIdx].gameObject.SetActive(false);
                    this.text_Item[panelObjectIdx].gameObject.SetActive(true);
                }
            }
        }
    }
Пример #12
0
        /// <summary>
        /// Takes a span aligned to a major record, and attempts to locate the game setting type.
        /// Will throw if the span is misaligned or doesn't start at a valid major record header.
        /// </summary>
        /// <param name="span">Data beginning at the start of a major record</param>
        /// <param name="meta">Game meta information to use in parsing</param>
        /// <returns>A response of the GameSettingType if found, or a reason if not.</returns>
        public static GetResponse <GameSettingType> GetGameSettingType(ReadOnlyMemorySlice <byte> span, GameConstants meta)
        {
            var majorMeta = meta.MajorRecordFrame(span);
            var edidLoc   = PluginUtilityTranslation.FindFirstSubrecord(majorMeta.Content, meta, Constants.EditorID);

            if (edidLoc == null)
            {
                return(GetResponse <GameSettingType> .Fail($"EDID was not located"));
            }
            var edidMeta = meta.SubrecordFrame(majorMeta.Content.Slice(edidLoc.Value));
            var edid     = BinaryStringUtility.ProcessWholeToZString(edidMeta.Content);

            if (edid.Length == 0)
            {
                return(GetResponse <GameSettingType> .Fail("No EDID parsed."));
            }
            if (!TryGetGameSettingType(edid[0], out var settingType))
            {
                return(GetResponse <GameSettingType> .Fail($"Unknown game setting type: {edid[0]}"));
            }
            return(GetResponse <GameSettingType> .Succeed(settingType));
        }
Пример #13
0
            public static void WriteWorldspacesParallel(
                IGroupGetter <IWorldspaceGetter> group,
                MasterReferenceReader masters,
                int targetIndex,
                GameConstants gameConstants,
                Stream[] streamDepositArray)
            {
                var cache = group.RecordCache;

                if (cache == null || cache.Count == 0)
                {
                    return;
                }
                Stream[] streams    = new Stream[cache.Count + 1];
                byte[]   groupBytes = new byte[gameConstants.GroupConstants.HeaderLength];
                BinaryPrimitives.WriteInt32LittleEndian(groupBytes.AsSpan(), RecordTypes.GRUP.TypeInt);
                var groupByteStream = new MemoryStream(groupBytes);

                using (var stream = new MutagenWriter(groupByteStream, gameConstants, dispose: false))
                {
                    stream.Position += 8;
                    GroupBinaryWriteTranslation.WriteEmbedded <IWorldspaceGetter>(group, stream);
                }
                streams[0] = groupByteStream;
                Parallel.ForEach(group, (worldspace, worldspaceState, worldspaceCounter) =>
                {
                    var worldTrib = new MemoryTributary();
                    var bundle    = new WritingBundle(gameConstants)
                    {
                        MasterReferences = masters
                    };
                    using (var writer = new MutagenWriter(worldTrib, bundle, dispose: false))
                    {
                        using (HeaderExport.Header(
                                   writer: writer,
                                   record: RecordTypes.WRLD,
                                   type: ObjectType.Record))
                        {
                            WorldspaceBinaryWriteTranslation.WriteEmbedded(
                                item: worldspace,
                                writer: writer);
                            WorldspaceBinaryWriteTranslation.WriteRecordTypes(
                                item: worldspace,
                                writer: writer,
                                recordTypeConverter: null);
                        }
                    }
                    var topCell  = worldspace.TopCell;
                    var subCells = worldspace.SubCells;
                    if (subCells?.Count == 0 &&
                        topCell == null)
                    {
                        streams[worldspaceCounter + 1] = worldTrib;
                        return;
                    }

                    Stream[] subStreams = new Stream[(subCells?.Count ?? 0) + 1];

                    var worldGroupTrib   = new MemoryTributary();
                    var worldGroupWriter = new MutagenWriter(worldGroupTrib, bundle, dispose: false);
                    worldGroupWriter.Write(RecordTypes.GRUP.TypeInt);
                    worldGroupWriter.Write(UtilityTranslation.Zeros.Slice(0, gameConstants.GroupConstants.LengthLength));
                    FormKeyBinaryTranslation.Instance.Write(
                        worldGroupWriter,
                        worldspace.FormKey);
                    worldGroupWriter.Write((int)GroupTypeEnum.WorldChildren);
                    worldGroupWriter.Write(worldspace.SubCellsTimestamp);
                    worldGroupWriter.Write(worldspace.SubCellsUnknown);
                    topCell?.WriteToBinary(worldGroupWriter);
                    subStreams[0] = worldGroupTrib;

                    if (subCells != null)
                    {
                        Parallel.ForEach(subCells, (block, blockState, blockCounter) =>
                        {
                            WriteBlocksParallel(
                                block,
                                masters,
                                (int)blockCounter + 1,
                                gameConstants,
                                subStreams);
                        });
                    }

                    worldGroupWriter.Position = 4;
                    worldGroupWriter.Write((uint)(subStreams.NotNull().Select(s => s.Length).Sum()));
                    streams[worldspaceCounter + 1] = new CompositeReadStream(worldTrib.AsEnumerable().And(subStreams), resetPositions: true);
                });
                UtilityTranslation.CompileSetGroupLength(streams, groupBytes);
                streamDepositArray[targetIndex] = new CompositeReadStream(streams, resetPositions: true);
            }
Пример #14
0
 // Token: 0x06001315 RID: 4885 RVA: 0x00213278 File Offset: 0x00211478
 public override void UpDateRowItem(GameObject item, int dataIdx, int panelObjectIdx, int panelId)
 {
     if (dataIdx == 0)
     {
         item.transform.GetChild(0).gameObject.SetActive(true);
         item.transform.GetChild(1).gameObject.SetActive(false);
         UIText component = item.transform.GetChild(0).GetChild(4).GetComponent <UIText>();
         component.text = DataManager.Instance.mStringTable.GetStringByID(7062u);
         component.SetAllDirty();
         component.cachedTextGenerator.Invalidate();
         component      = item.transform.GetChild(0).GetChild(5).GetComponent <UIText>();
         component.text = DataManager.Instance.mStringTable.GetStringByID(17034u);
         component.SetAllDirty();
         component.cachedTextGenerator.Invalidate();
         component      = item.transform.GetChild(0).GetChild(6).GetComponent <UIText>();
         component.text = DataManager.Instance.mStringTable.GetStringByID(7094u);
         component.SetAllDirty();
         component.cachedTextGenerator.Invalidate();
         component      = item.transform.GetChild(0).GetChild(7).GetComponent <UIText>();
         component.text = DataManager.Instance.mStringTable.GetStringByID(17039u);
         component.SetAllDirty();
         component.cachedTextGenerator.Invalidate();
     }
     else
     {
         item.transform.GetChild(0).gameObject.SetActive(false);
         item.transform.GetChild(1).gameObject.SetActive(true);
         item.transform.GetChild(1).GetChild(10).gameObject.SetActive(true);
         item.transform.GetChild(1).GetChild(12).gameObject.SetActive(true);
         this.SortTextArray[0, panelObjectIdx].ClearString();
         this.SortTextArray[0, panelObjectIdx].IntToFormat((long)dataIdx, 1, false);
         this.SortTextArray[0, panelObjectIdx].AppendFormat("{0}");
         UIText component = item.transform.GetChild(1).GetChild(4).GetComponent <UIText>();
         component.text = this.SortTextArray[0, panelObjectIdx].ToString();
         component.SetAllDirty();
         component.cachedTextGenerator.Invalidate();
         this.SortTextArray[1, panelObjectIdx].ClearString();
         GameConstants.GetNameString(this.SortTextArray[1, panelObjectIdx], 0, LeaderBoardManager.Instance.AllianceWarGroupBoard[dataIdx - 1].Name, LeaderBoardManager.Instance.AllianceWarGroupBoard[dataIdx - 1].AllianceTag, false);
         component      = item.transform.GetChild(1).GetChild(5).GetComponent <UIText>();
         component.text = this.SortTextArray[1, panelObjectIdx].ToString();
         component.SetAllDirty();
         component.cachedTextGenerator.Invalidate();
         this.SortTextArray[2, panelObjectIdx].ClearString();
         this.SortTextArray[2, panelObjectIdx].uLongToFormat(LeaderBoardManager.Instance.AllianceWarGroupBoard[dataIdx - 1].Power, 1, true);
         this.SortTextArray[2, panelObjectIdx].AppendFormat("{0}");
         component      = item.transform.GetChild(1).GetChild(6).GetComponent <UIText>();
         component.text = this.SortTextArray[2, panelObjectIdx].ToString();
         component.SetAllDirty();
         component.cachedTextGenerator.Invalidate();
         this.SortTextArray[3, panelObjectIdx].ClearString();
         this.SortTextArray[3, panelObjectIdx].IntToFormat((long)LeaderBoardManager.Instance.AllianceWarGroupBoard[dataIdx - 1].Score, 1, true);
         this.SortTextArray[3, panelObjectIdx].AppendFormat("{0}");
         component      = item.transform.GetChild(1).GetChild(7).GetComponent <UIText>();
         component.text = this.SortTextArray[3, panelObjectIdx].ToString();
         component.SetAllDirty();
         component.cachedTextGenerator.Invalidate();
         if (dataIdx == LeaderBoardManager.Instance.AllianceWarGroupRank)
         {
             UISpritesArray component2 = item.transform.GetChild(1).GetChild(0).GetComponent <UISpritesArray>();
             component2.SetSpriteIndex(2);
             component2 = item.transform.GetChild(1).GetChild(1).GetComponent <UISpritesArray>();
             component2.SetSpriteIndex(2);
             component2 = item.transform.GetChild(1).GetChild(2).GetComponent <UISpritesArray>();
             component2.SetSpriteIndex(2);
             component2 = item.transform.GetChild(1).GetChild(3).GetComponent <UISpritesArray>();
             component2.SetSpriteIndex(2);
         }
         else if (dataIdx % 2 == 0)
         {
             UISpritesArray component2 = item.transform.GetChild(1).GetChild(0).GetComponent <UISpritesArray>();
             component2.SetSpriteIndex(1);
             component2 = item.transform.GetChild(1).GetChild(1).GetComponent <UISpritesArray>();
             component2.SetSpriteIndex(1);
             component2 = item.transform.GetChild(1).GetChild(2).GetComponent <UISpritesArray>();
             component2.SetSpriteIndex(1);
             component2 = item.transform.GetChild(1).GetChild(3).GetComponent <UISpritesArray>();
             component2.SetSpriteIndex(1);
         }
         else
         {
             UISpritesArray component2 = item.transform.GetChild(1).GetChild(0).GetComponent <UISpritesArray>();
             component2.SetSpriteIndex(0);
             component2 = item.transform.GetChild(1).GetChild(1).GetComponent <UISpritesArray>();
             component2.SetSpriteIndex(0);
             component2 = item.transform.GetChild(1).GetChild(2).GetComponent <UISpritesArray>();
             component2.SetSpriteIndex(0);
             component2 = item.transform.GetChild(1).GetChild(3).GetComponent <UISpritesArray>();
             component2.SetSpriteIndex(0);
         }
         UIButton component3 = item.transform.GetChild(1).GetChild(10).GetComponent <UIButton>();
         component3.m_Handler = this;
         component3.m_BtnID1  = 6;
         component3.m_BtnID2  = dataIdx - 1;
         component3           = item.transform.GetChild(1).GetChild(12).GetComponent <UIButton>();
         component3.m_Handler = this;
         component3.m_BtnID1  = 11;
         component3.m_BtnID2  = dataIdx;
         component            = item.transform.GetChild(1).GetChild(4).GetComponent <UIText>();
         if (dataIdx <= (int)LeaderBoardManager.Instance.AllianceWarGroupRankUpNum)
         {
             component3.m_BtnID3 = 1;
             component.color     = new Color32(byte.MaxValue, byte.MaxValue, 0, byte.MaxValue);
         }
         else if (dataIdx >= (int)LeaderBoardManager.Instance.AllianceWarGroupRankDownNum)
         {
             component3.m_BtnID3 = 2;
             component.color     = new Color32(0, byte.MaxValue, byte.MaxValue, byte.MaxValue);
         }
         else
         {
             component3.m_BtnID3 = 3;
             component.color     = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
         }
         UIButtonHint component4 = item.transform.GetChild(1).GetChild(12).GetComponent <UIButtonHint>();
         component4.Parm1          = (ushort)dataIdx;
         component4.m_eHint        = EUIButtonHint.DownUpHandler;
         component4.m_Handler      = this;
         component4.ControlFadeOut = GUIManager.Instance.m_Arena_Hint.m_RectTransform.gameObject;
     }
 }
Пример #15
0
        protected override async Task Handle(GameStageUser stageUser, IFieldObjUser user, IPacketReader packet)
        {
            _ = packet.ReadInt();
            var templateID = packet.ReadInt();
            var template   = await stageUser.Stage.SkillTemplates.Retrieve(templateID);

            if (template == null)
            {
                return;
            }

            var job      = template.ID / 10000;
            var jobLevel = (byte)GameConstants.GetJobLevel(job);

            // TODO: job checks

            if (jobLevel == 0)
            {
                var sp = Math.Min(user.Character.Level - 1, job == 3000 ? 9 : 6);

                for (var i = 0; i < 3; i++)
                {
                    sp -= user.Character.GetSkillLevel(job * 1000 + 1000 + i);
                }
                if (sp > 0)
                {
                    await user.ModifySkills(s => s.Add(templateID), true);
                }
                return;
            }

            if (GameConstants.IsExtendSPJob(job) && user.Character.GetExtendSP(jobLevel) <= 0)
            {
                return;
            }
            if (!GameConstants.IsExtendSPJob(job) && user.Character.SP <= 0)
            {
                return;
            }

            var maxLevel = template.MaxLevel;

            if (GameConstants.IsSkillNeedMasterLevel(templateID))
            {
                maxLevel = (short)user.Character.GetSkillMasterLevel(templateID);
            }

            if (user.Character.GetSkillLevel(templateID) >= maxLevel)
            {
                return;
            }

            var increment = 1;

            await user.ModifyStats(s =>
            {
                if (GameConstants.IsExtendSPJob(job))
                {
                    s.SetExtendSP(jobLevel, (byte)(s.GetExtendSP(jobLevel) - increment));
                }
                else
                {
                    s.SP--;
                }
            });

            await user.ModifySkills(s => s.Add(templateID, increment), true);
        }
Пример #16
0
        internal static IEnumerable <SubrecordPinFrame> EnumerateSubrecords(ReadOnlyMemorySlice <byte> span, GameConstants meta, int loc)
        {
            while (loc < span.Length)
            {
                var subHeader = new SubrecordPinFrame(meta, span.Slice(loc), loc);
                yield return(subHeader);

                loc += subHeader.TotalLength;
            }
        }
Пример #17
0
    // Token: 0x0600219C RID: 8604 RVA: 0x00401468 File Offset: 0x003FF668
    private void initCorpsStage()
    {
        ushort     num;
        CorpsStage recordByKey;

        if (DataManager.Instance.lastBattleResult == 1)
        {
            num         = DataManager.StageDataController.StageRecord[2];
            recordByKey = DataManager.StageDataController.CorpsStageTable.GetRecordByKey(num);
        }
        else
        {
            if (DataManager.StageDataController.StageRecord[2] >= DataManager.StageDataController.limitRecord[2])
            {
                if (this.CorpsStageGameObject != null)
                {
                    this.CorpsStageGameObject.SetActive(false);
                }
                return;
            }
            num         = DataManager.StageDataController.StageRecord[2] + 1;
            recordByKey = DataManager.StageDataController.CorpsStageTable.GetRecordByKey(num);
        }
        if (this.CorpsStageGameObject == null)
        {
            if (num != this.currentCorpsStageRecord)
            {
                this.currentCorpsStageRecord = num;
            }
            this.CorpsStageGameObject = new GameObject("CorpsStage");
        }
        else
        {
            if (num == this.currentCorpsStageRecord)
            {
                return;
            }
            this.currentCorpsStageRecord = num;
            this.CastleModelEff.transform.SetParent(null);
            this.CastleModel.transform.SetParent(null);
            this.LordModel.transform.SetParent(null);
            UnityEngine.Object.Destroy(this.LordModel);
            AssetManager.UnloadAssetBundle(this.LordassetKey, true);
            this.LordModel = null;
            AssetManager.UnloadAssetBundle(this.ShadowassetKey, true);
            this.ShadowassetKey = 0;
        }
        CString   cstring   = StringManager.Instance.SpawnString(30);
        Transform transform = this.CorpsStageGameObject.transform;

        transform.position = GameConstants.WordToVector3(recordByKey.CastlePos.X, recordByKey.CastlePos.Y, recordByKey.CastlePos.Z, -100, 0.01f);
        if (this.CastleModel == null)
        {
            cstring.ClearString();
            cstring.AppendFormat("Role/npccastle");
            AssetBundle assetBundle = AssetManager.GetAssetBundle(cstring, out this.CastleassetKey);
            this.CastleModel = (UnityEngine.Object.Instantiate(assetBundle.mainAsset) as GameObject);
        }
        Transform transform2 = this.CastleModel.transform;

        transform2.SetParent(transform);
        transform2.localScale = Vector3.one * (float)recordByKey.CastleScale * 0.01f;
        Vector3 eulerAngles = transform2.eulerAngles;

        eulerAngles.y          = (float)recordByKey.CastleRotY * 0.01f;
        transform2.eulerAngles = eulerAngles;
        transform2.position    = GameConstants.WordToVector3(recordByKey.CastlePos.X, recordByKey.CastlePos.Y, recordByKey.CastlePos.Z, -100, 0.01f);
        ushort num2 = 0;

        if (this.LordModel == null)
        {
            Hero   recordByKey2 = DataManager.Instance.HeroTable.GetRecordByKey(recordByKey.Heros[0].HeroID);
            ushort num3         = recordByKey2.Modle;
            if (!DataManager.Instance.CheckHero3DMesh(recordByKey.Heros[0].HeroID))
            {
                num3 = 1;
            }
            num2 = recordByKey2.Radius;
            cstring.ClearString();
            cstring.StringToFormat("Role/hero_");
            cstring.IntToFormat((long)num3, 5, false);
            cstring.AppendFormat("{0}{1}");
            AssetBundle assetBundle = AssetManager.GetAssetBundle(cstring, out this.LordassetKey);
            if (assetBundle)
            {
                this.LordModel = (UnityEngine.Object.Instantiate(assetBundle.Load("m")) as GameObject);
            }
        }
        if (this.LordModel)
        {
            transform2 = this.LordModel.transform;
        }
        transform2.SetParent(transform);
        transform2.localScale = Vector3.one * (float)recordByKey.LordScale * 0.01f;
        transform2.position   = GameConstants.WordToVector3(recordByKey.LordPos.X, recordByKey.LordPos.Y, recordByKey.LordPos.Z, -100, 0.01f);
        if (this.ShadowassetKey == 0)
        {
            AssetBundle assetBundle = AssetManager.GetAssetBundle("UI/shadow", out this.ShadowassetKey, false);
            GameObject  gameObject  = UnityEngine.Object.Instantiate(assetBundle.mainAsset) as GameObject;
            this.ShadowTransform = gameObject.transform;
            this.ShadowTransform.SetParent(transform2, false);
            MeshFilter component = gameObject.GetComponent <MeshFilter>();
            component.mesh        = GameConstants.CreatePlane(transform2.forward, transform2.right, new Rect(0f, 0f, 1f, 1f), new Color(1f, 1f, 1f, 0.6f), (float)num2 * 0.015f);
            this.LordBipTransform = transform2.GetChild(0);
        }
        ParticleManager.Instance.DeSpawn(this.CastleModelEff);
        this.CastleModelEff = ParticleManager.Instance.Spawn(309, transform, Vector3.zero, (float)recordByKey.CastleScale * 0.01f, true, true, true);
        this.CastleModelEff.SetActive(true);
        StringManager.Instance.DeSpawnString(cstring);
    }
Пример #18
0
 private static int GetGodLevel()
 {
     return(GameConstants.GetConstant <int>("MaximumLevel") - 7);
 }
Пример #19
0
    // Token: 0x06002194 RID: 8596 RVA: 0x004003B4 File Offset: 0x003FE5B4
    public void Renew(byte[] Subject, byte[] meg)
    {
        GAME_PLAYER_NEWS game_PLAYER_NEWS = (GAME_PLAYER_NEWS)Subject[0];

        switch (game_PLAYER_NEWS)
        {
        case GAME_PLAYER_NEWS.Network_Update:
        {
            NetworkNews networkNews = (NetworkNews)Subject[1];
            if (networkNews != NetworkNews.Login)
            {
                if (networkNews == NetworkNews.Refresh_Hospital || networkNews == NetworkNews.Refresh_Trap)
                {
                    DataManager.msgBuffer[0] = 9;
                    this.notifyNews(DataManager.msgBuffer);
                }
            }
            else if (this.WorldInputLockCount > 0)
            {
                for (int i = 0; i < this.WorldInputLockCount; i++)
                {
                    GUIManager.Instance.ShowUILock(EUILock.Normal);
                }
            }
            break;
        }

        default:
            if (game_PLAYER_NEWS == GAME_PLAYER_NEWS.ORIGIN_CameraReSetPressPosition)
            {
                this.cameraController.ReSetPressPosition();
            }
            break;

        case GAME_PLAYER_NEWS.ORIGIN_DoorOpenUp:
        case GAME_PLAYER_NEWS.ORIGIN_WildOpenUp:
        {
            DataManager.msgBuffer[0] = 12;
            this.notifyNews(DataManager.msgBuffer);
            DataManager.Instance.WorldCameraPos   = Camera.main.transform.position;
            DataManager.Instance.WorldCameraLimit = this.cameraController.Limit;
            DataManager.Instance.bWorldF          = false;
            byte leveL = (DataManager.StageDataController._stageMode == StageMode.Corps) ? ((byte)(DataManager.StageDataController.StageRecord[2] + 1)) : DataManager.StageDataController.currentChapterID;
            this.cameraController.SetCameraState(CameraState.Area, leveL, true);
            AudioManager.Instance.PlayUISFX(UIKind.ArmyExpewdition);
            break;
        }

        case GAME_PLAYER_NEWS.ORIGIN_DoorWild:
            if (this.nextWorldMode == WorldMode.OpenUp)
            {
                DataManager.Instance.bWorldF = true;
                if (DataManager.StageDataController._stageMode == StageMode.Corps)
                {
                    DataManager.msgBuffer[0] = 2;
                    this.notifyNews(DataManager.msgBuffer);
                }
                else
                {
                    GUIManager.Instance.pDVMgr.NextTransitions(eTrans.BEGIN, eTransFunc.DoorWild);
                }
                GUIManager.Instance.m_HUDMessage.MapHud.ThisTransform.gameObject.SetActive(false);
            }
            break;

        case GAME_PLAYER_NEWS.ORIGIN_DoorNext:
            if (this.nextWorldMode == WorldMode.OpenUp)
            {
                StageManager stageDataController = DataManager.StageDataController;
                stageDataController.currentChapterID          += 1;
                DataManager.StageDataController.currentPointID = (ushort)(DataManager.StageDataController.currentChapterID - 1) * GameConstants.StagePointNum[(int)DataManager.StageDataController._stageMode] + 1;
                DataManager.StageDataController.SaveUserStage(DataManager.StageDataController._stageMode);
                DataManager.Instance.lastBattleResult = -1;
                this.cameraController.SetCameraPos((int)DataManager.StageDataController.currentChapterID);
                DataManager.msgBuffer[0] = 6;
                this.notifyNews(DataManager.msgBuffer);
                GUIManager.Instance.m_HUDMessage.MapHud.AddChapterMsg();
            }
            break;

        case GAME_PLAYER_NEWS.ORIGIN_DoorLast:
            if (this.nextWorldMode == WorldMode.OpenUp)
            {
                StageManager stageDataController2 = DataManager.StageDataController;
                stageDataController2.currentChapterID         -= 1;
                DataManager.StageDataController.currentPointID = (ushort)DataManager.StageDataController.currentChapterID * GameConstants.StagePointNum[(int)DataManager.StageDataController._stageMode];
                DataManager.StageDataController.SaveUserStage(DataManager.StageDataController._stageMode);
                DataManager.Instance.lastBattleResult = -1;
                this.cameraController.SetCameraPos((int)DataManager.StageDataController.currentChapterID);
                DataManager.msgBuffer[0] = 6;
                this.notifyNews(DataManager.msgBuffer);
                GUIManager.Instance.m_HUDMessage.MapHud.AddChapterMsg();
            }
            break;

        case GAME_PLAYER_NEWS.ORIGIN_CameraOpenUp:
            if (DataManager.StageDataController._stageMode != StageMode.Corps || DataManager.StageDataController.isNotFirstInChapter[2] == 1)
            {
                this.SwitchWorldMode(WorldMode.OpenUp);
                DataManager.msgBuffer[0] = 14;
                GameManager.notifyObservers(1, 0, DataManager.msgBuffer);
                GUIManager.Instance.m_HUDMessage.MapHud.AddChapterMsg();
                GUIManager.Instance.m_HUDMessage.MapHud.ShowMsg();
                GUIManager.Instance.m_HUDMessage.MapHud.ShowTime = 0.8f;
                GUIManager.Instance.m_HUDMessage.MapHud.StartCountdown();
                this.WorldUIQueueLockRelease();
            }
            else
            {
                DataManager.msgBuffer[0] = 47;
                GameManager.notifyObservers(1, 0, DataManager.msgBuffer);
            }
            break;

        case GAME_PLAYER_NEWS.ORIGIN_CameraWild:
            if (DataManager.StageDataController._stageMode == StageMode.Corps)
            {
                this.cameraController.Limit    = DataManager.Instance.WorldCameraLimit;
                this.cameraController.TmpV3Pos = DataManager.Instance.WorldCameraPos;
                this.cameraController.SetCameraState(CameraState.World, 0, false);
            }
            else if (DataManager.StageDataController._stageMode == StageMode.Count)
            {
                this.cameraController.SetCameraState(CameraState.World, 0, false);
                GUIManager.Instance.pDVMgr.NextTransitions(eTrans.END, eTransFunc.Max);
            }
            else
            {
                DataManager.Instance.WorldCameraLimit = 0f;
                this.cameraController.SetCamerPos_Out();
                GUIManager.Instance.pDVMgr.NextTransitions(eTrans.END, eTransFunc.Max);
            }
            break;

        case GAME_PLAYER_NEWS.ORIGIN_CameraForce:
            if (DataManager.StageDataController._stageMode == StageMode.Corps && DataManager.StageDataController.isNotFirstInChapter[2] == 0)
            {
                this.cloudController.MapClick();
            }
            break;

        case GAME_PLAYER_NEWS.ORIGIN_CloudOpenUp:
            this.SwitchWorldMode(WorldMode.OpenUp);
            DataManager.msgBuffer[0] = 14;
            GameManager.notifyObservers(1, 0, DataManager.msgBuffer);
            break;

        case GAME_PLAYER_NEWS.ORIGIN_LockInput:
            this.worldflag |= 1;
            break;

        case GAME_PLAYER_NEWS.ORIGIN_UnLockInput:
            this.worldflag &= -2;
            break;

        case GAME_PLAYER_NEWS.ORIGIN_CloseStageStory:
        case GAME_PLAYER_NEWS.ORIGIN_CloseTreasureInfo:
            if (DataManager.StageDataController.isNotFirstInChapter[(int)DataManager.StageDataController._stageMode] == 0)
            {
                if (DataManager.StageDataController._stageMode == StageMode.Corps)
                {
                    this.worldflag |= 4;
                    if (DataManager.StageDataController.StageRecord[2] == 2 && DataManager.StageDataController.StageRecord[1] == 0 && DataManager.StageDataController.StageRecord[0] == 18)
                    {
                        this.worldflag |= 2;
                    }
                }
                else if ((ushort)(DataManager.StageDataController.currentChapterID + 1) * GameConstants.LinePointNum[(int)DataManager.StageDataController._stageMode] < DataManager.StageDataController.limitRecord[(int)DataManager.StageDataController._stageMode])
                {
                    StageManager stageDataController3 = DataManager.StageDataController;
                    stageDataController3.currentChapterID += 1;
                }
                DataManager.DataBuffer[0] = 4;
                this.Renew(DataManager.DataBuffer, null);
                if (Subject[0] == 39)
                {
                    this.WorldUIQueueLockRelease();
                }
            }
            else if (DataManager.StageDataController.StageRecord[(int)DataManager.StageDataController._stageMode] == DataManager.StageDataController.limitRecord[(int)DataManager.StageDataController._stageMode])
            {
                if (DataManager.StageDataController._stageMode == StageMode.Corps)
                {
                    this.worldflag |= 4;
                }
                DataManager.DataBuffer[0] = 4;
                this.Renew(DataManager.DataBuffer, null);
                if (Subject[0] == 39)
                {
                    this.WorldUIQueueLockRelease();
                }
            }
            else
            {
                if (DataManager.StageDataController._stageMode == StageMode.Full && DataManager.StageDataController.StageRecord[0] == 18)
                {
                    this.worldflag |= 2;
                }
                DataManager.DataBuffer[0] = 0;
                DataManager.DataBuffer[1] = 1;
                this.notifyObservers(DataManager.DataBuffer, null);
                DataManager.msgBuffer[0] = 13;
                this.notifyNews(DataManager.msgBuffer);
                this.worldState = TickSubject.Ready;
                if (DataManager.StageDataController._stageMode == StageMode.Full || DataManager.StageDataController._stageMode == StageMode.Lean)
                {
                    this.WorldUIQueueLockRelease();
                }
            }
            GUIManager.Instance.m_HUDMessage.MapHud.AddChapterMsg();
            if (DataManager.StageDataController._stageMode != StageMode.Corps || this.nextWorldMode == WorldMode.OpenUp)
            {
                GUIManager.Instance.m_HUDMessage.MapHud.ShowMsg();
            }
            GUIManager.Instance.m_HUDMessage.MapHud.ShowTime = 0.8f;
            GUIManager.Instance.m_HUDMessage.MapHud.StartCountdown();
            break;

        case GAME_PLAYER_NEWS.ORIGIN_CameraStateWild:
            if ((this.worldflag & 4) != 0)
            {
                this.worldflag &= -5;
                GUIManager.Instance.OpenMenu(EGUIWindow.UI_NewTerritory, (int)DataManager.StageDataController.StageRecord[2], 0, false, true, false);
            }
            else
            {
                this.WorldUIQueueLockRelease();
            }
            NewbieManager.EntryTest();
            Indemnify.CheckShowIndemnify();
            ActivityGiftManager.Instance.CheckShowActivityGiftEffect();
            DataManager.msgBuffer[0] = 47;
            GameManager.notifyObservers(1, 0, DataManager.msgBuffer);
            break;

        case GAME_PLAYER_NEWS.ORIGIN_OpenUpWild:
            this.SwitchWorldMode(WorldMode.Wild);
            break;

        case GAME_PLAYER_NEWS.ORIGIN_OpenUpContinue:
            DataManager.msgBuffer[0] = 4;
            this.notifyNews(DataManager.msgBuffer);
            break;

        case GAME_PLAYER_NEWS.ORIGIN_ManorGuildCameraMove:
        {
            BuildManorData recordByKey    = DataManager.Instance.BuildManorData.GetRecordByKey(GameConstants.ConvertBytesToUShort(DataManager.msgBuffer, 3));
            float          num            = ((recordByKey.bPosionX <= 30000) ? ((float)recordByKey.bPosionX) : ((float)recordByKey.bPosionX - 65535f)) * 0.01f;
            float          y              = ((recordByKey.bPosionY <= 32768) ? ((float)recordByKey.bPosionY) : ((float)recordByKey.bPosionY - 65535f)) * 0.01f;
            float          num2           = ((recordByKey.bPosionZ <= 32768) ? ((float)recordByKey.bPosionZ) : ((float)recordByKey.bPosionZ - 65535f)) * 0.01f;
            Vector3        targetPosition = new Vector3(num + 4f, y, num2 - 23.5f);
            this.cameraController.CameraMoveTarget(CameraState.Build, targetPosition);
            DataManager.msgBuffer[0] = 11;
            this.notifyNews(DataManager.msgBuffer);
            break;
        }

        case GAME_PLAYER_NEWS.ORIGIN_ArneaGuildCameraMove:
        {
            Vector3 targetPosition2 = new Vector3(119.07f, 30.8f, 78.78f);
            this.cameraController.CameraMoveTarget(CameraState.Build, targetPosition2);
            break;
        }

        case GAME_PLAYER_NEWS.ORIGIN_DugoutGuildCameraMove:
        {
            Vector3 targetPosition3 = new Vector3(-22.22f, 13.39f, -22.2f);
            this.cameraController.CameraMoveTarget(CameraState.Build, targetPosition3);
            break;
        }

        case GAME_PLAYER_NEWS.ORIGIN_BlackMarketGuildCameraMove:
        {
            Vector3 targetPosition4 = new Vector3(51.5f, -0.5f, 87.44f);
            this.cameraController.CameraMoveTarget(CameraState.Build, targetPosition4);
            break;
        }

        case GAME_PLAYER_NEWS.ORIGIN_WarlobbyGuildCameraMove:
            if (GUIManager.Instance.BuildingData.ManorGride[6] != null)
            {
                this.cameraController.CameraMoveTarget(CameraState.Build, GUIManager.Instance.BuildingData.ManorGride[6].position);
            }
            break;

        case GAME_PLAYER_NEWS.ORIGIN_CasinoGuildCameraMove:
        {
            Vector3 targetPosition5 = new Vector3(131.5f, 9.1f, -7.7f);
            this.cameraController.CameraMoveTarget(CameraState.Build, targetPosition5);
            break;
        }

        case GAME_PLAYER_NEWS.ORIGIN_LaboratoryGuildCameraMove:
        {
            Vector3 targetPosition6 = new Vector3(-5.2f, 0.6f, 130.1f);
            this.cameraController.CameraMoveTarget(CameraState.Build, targetPosition6);
            break;
        }

        case GAME_PLAYER_NEWS.ORIGIN_PetListGuildCameraMove:
        {
            Vector3 targetPosition7 = new Vector3(193.63f, 16.2f, -14.29f);
            this.cameraController.CameraMoveTarget(CameraState.Build, targetPosition7);
            break;
        }

        case GAME_PLAYER_NEWS.ORIGIN_UpdateBuild:
            DataManager.msgBuffer[0] = 5;
            this.notifyNews(DataManager.msgBuffer);
            break;

        case GAME_PLAYER_NEWS.ORIGIN_UpdateOpenUp:
            if (this.nextWorldMode == WorldMode.OpenUp)
            {
                this.UpdateWorldState();
            }
            break;

        case GAME_PLAYER_NEWS.ORIGIN_ChangeStageMode:
            if (this.nextWorldMode == WorldMode.OpenUp)
            {
                if (Subject[1] == 1)
                {
                    DataManager.StageDataController.resetStageMode(StageMode.Full);
                }
                else if (Subject[1] == 2)
                {
                    DataManager.StageDataController.resetStageMode(StageMode.Lean);
                }
                else if (Subject[1] == 3)
                {
                    DataManager.StageDataController.resetStageMode(StageMode.Dare);
                    if (DataManager.StageDataController.StageRecord[3] >= GameConstants.StagePointNum[3] && !NewbieManager.IsLeadNewbiePass)
                    {
                        DataManager.StageDataController.currentChapterID = 1;
                        DataManager.StageDataController.currentPointID   = (ushort)(DataManager.StageDataController.currentChapterID - 1) * GameConstants.StagePointNum[(int)DataManager.StageDataController._stageMode] + 1;
                        DataManager.StageDataController.SaveUserStage(DataManager.StageDataController._stageMode);
                    }
                }
                DataManager.StageDataController.SaveUserStageMode(DataManager.StageDataController._stageMode);
                DataManager.Instance.lastBattleResult = -1;
                this.cameraController.SetCameraPos((int)DataManager.StageDataController.currentChapterID);
                this.UpdateWorldState();
                GUIManager.Instance.m_HUDMessage.MapHud.AddChapterMsg();
                GUIManager.Instance.m_HUDMessage.MapHud.ShowMsg();
                GUIManager.Instance.m_HUDMessage.MapHud.ShowTime = 0.8f;
                GUIManager.Instance.m_HUDMessage.MapHud.StartCountdown();
            }
            break;

        case GAME_PLAYER_NEWS.ORIGIN_HideCampain:
            DataManager.msgBuffer[0] = 8;
            this.notifyNews(DataManager.msgBuffer);
            break;

        case GAME_PLAYER_NEWS.ORIGIN_OpenUpFirstRun:
            if (DataManager.StageDataController._stageMode == StageMode.Full)
            {
                if ((this.worldflag & 2) != 0)
                {
                    NewbieManager.CheckTeach(ETeachKind.ELITE_STAGE, null, true);
                    this.worldflag &= -3;
                }
                if ((DataManager.StageDataController.StageRecord[0] != 0 || !NewbieManager.CheckTeach(ETeachKind.BATTLE_BEFORE, null, true)) && NewbieManager.CheckPutOnEquipTeach())
                {
                    NewbieManager.CheckTeach(ETeachKind.PUTON_EQUIP, null, false);
                }
            }
            else if (DataManager.StageDataController._stageMode == StageMode.Corps)
            {
                NewbieManager.CheckTeach(ETeachKind.WAR_SCOUT, this, true);
            }
            break;

        case GAME_PLAYER_NEWS.ORIGIN_BuildOpenUp:
            if (DataManager.StageDataController._stageMode != StageMode.Corps || DataManager.StageDataController.isNotFirstInChapter[2] == 1)
            {
                if (DataManager.StageDataController._stageMode == StageMode.Dare && DataManager.StageDataController.StageRecord[3] >= GameConstants.StagePointNum[3] && !NewbieManager.IsLeadNewbiePass)
                {
                    DataManager.StageDataController.currentChapterID = 1;
                    DataManager.StageDataController.currentPointID   = (ushort)(DataManager.StageDataController.currentChapterID - 1) * GameConstants.StagePointNum[(int)DataManager.StageDataController._stageMode] + 1;
                    DataManager.StageDataController.SaveUserStage(DataManager.StageDataController._stageMode);
                }
                DataManager.Instance.WorldCameraPos   = GameConstants.GoldGuy;
                DataManager.Instance.WorldCameraLimit = 0f;
                DataManager.Instance.bWorldF          = false;
                this.cameraController.SetCameraPos((int)DataManager.StageDataController.currentChapterID);
                this.SwitchWorldMode(WorldMode.OpenUp);
                DataManager.msgBuffer[0] = 14;
                GameManager.notifyObservers(1, 0, DataManager.msgBuffer);
            }
            break;

        case GAME_PLAYER_NEWS.ORIGIN_UIQueueLock:
            this.WorldUIQueueLock();
            break;

        case GAME_PLAYER_NEWS.ORIGIN_UIQueueLockRelease:
            this.WorldUIQueueLockRelease();
            break;

        case GAME_PLAYER_NEWS.ORIGIN_UIInputLock:
            this.WorldInputLockCount++;
            GUIManager.Instance.ShowUILock(EUILock.Normal);
            break;

        case GAME_PLAYER_NEWS.ORIGIN_UIInputLockRelease:
            this.WorldInputLockCount--;
            GUIManager.Instance.HideUILock(EUILock.Normal);
            break;
        }
    }
Пример #20
0
 public static GameObject GetCombinationObject(GameConstants.BuildingID buildingID1, GameConstants.BuildingID buildingID2)
 {
     return combinationTable[(int)buildingID1][(int)buildingID2];
 }
Пример #21
0
 private static int GetMaximumFight()
 {
     return(GameConstants.GetConstant <int>("MaximumFight"));
 }
Пример #22
0
 // Use this for initialization
 void Start()
 {
     animator      = GetComponent <Animator>();
     gameConstants = (GameConstants)GameObject.Find("GameConstants").GetComponent("GameConstants");
     AudioSource.PlayClipAtPoint(levelStart, Vector2.zero);
 }
Пример #23
0
        public static void repair_one_obj(CharacterInstance ch, MobileInstance keeper, ObjectInstance obj,
                                          string arg, int maxgold, string fixstr, string fixstr2)
        {
            int    cost;
            string buffer;

            if (!ch.CanDrop(obj))
            {
                ch.Printf("You can't let go of %s.\r\n", obj.Name);
            }
            else if ((cost = Appraise.GetAdjustedRepairCost(keeper, obj)) < 0)
            {
                if (cost < 0)
                {
                    comm.act(ATTypes.AT_TELL,
                             cost != -2
                                 ? "$n tells you, 'Sorry, I can't do anything with $p.'"
                                 : "$n tells you, '$p looks fine to me!'", keeper, obj, ch, ToTypes.Victim);
                }
            }

            // repair all gets a 10% surcharge
            else if ((cost = arg.Equals("all") ? cost : 11 * (cost / 10)) > ch.CurrentCoin)
            {
                buffer =
                    $"$N tells you, 'It will cost {cost} piece{(cost == 1 ? "" : "s")} of gold to {fixstr} {obj.Name}...'";
                comm.act(ATTypes.AT_TELL, buffer, ch, null, keeper, ToTypes.Character);
                comm.act(ATTypes.AT_TELL, "$n tells you, 'Which I see you can't afford.'", ch, null, keeper, ToTypes.Character);
            }
            else
            {
                buffer = $"$n gives $p to $N, who quickly {fixstr2} it.";
                comm.act(ATTypes.AT_ACTION, buffer, ch, obj, keeper, ToTypes.Room);

                buffer = $"$n charges you {cost} gold piece{(cost == 1 ? "" : "s")} to {fixstr} $p.";
                comm.act(ATTypes.AT_ACTION, buffer, ch, obj, keeper, ToTypes.Character);

                ch.CurrentCoin     -= cost;
                keeper.CurrentCoin += cost;

                if (keeper.CurrentCoin < 0)
                {
                    keeper.CurrentCoin = 0;
                }
                else if (keeper.CurrentCoin > maxgold)
                {
                    keeper.CurrentRoom.Area.BoostEconomy(keeper.CurrentCoin - maxgold / 2);
                    keeper.CurrentCoin = maxgold / 2;
                    comm.act(ATTypes.AT_ACTION, "$n puts some gold into a large safe.", keeper, null, null, ToTypes.Room);
                }

                switch (obj.ItemType)
                {
                default:
                    ch.SendTo("For some reason, you think you got ripped off...");
                    break;

                case ItemTypes.Armor:
                    obj.Values.CurrentAC = obj.Values.OriginalAC;
                    break;

                case ItemTypes.Weapon:
                    obj.Values.Condition = GameConstants.GetConstant <int>("InitWeaponCondition");
                    break;

                case ItemTypes.Wand:
                case ItemTypes.Staff:
                    obj.Values.Charges = obj.Values.MaxCharges;
                    break;
                }

                MudProgHandler.ExecuteObjectProg(MudProgTypes.Repair, ch, obj);
            }
        }
Пример #24
0
    // Token: 0x06001F1A RID: 7962 RVA: 0x003BADEC File Offset: 0x003B8FEC
    private void SetSkillHint(ushort heroID, byte enhance, int MaxNum, byte Arms)
    {
        byte[] array = new byte[]
        {
            1,
            2,
            4,
            8,
            20
        };
        Hero recordByKey = this.DM.HeroTable.GetRecordByKey(heroID);

        ushort[] array2 = new ushort[]
        {
            recordByKey.GroupSkill1,
            recordByKey.GroupSkill2,
            recordByKey.GroupSkill3,
            recordByKey.GroupSkill4
        };
        CurHeroData curHeroData = this.DM.curHeroData[(uint)heroID];

        this.GM.ChangeHeroItemImg(this.m_HeroIcon.transform, eHeroOrItem.Hero, heroID, curHeroData.Star, 0, 0);
        this.m_HeroNameText.text      = this.DM.mStringTable.GetStringByID((uint)recordByKey.HeroTitle);
        this.m_HeroArmsText.text      = this.GetArmsStr(Arms);
        this.m_HeroEnhanceIcon.sprite = this.GetEnhanceIcon(enhance);
        this.m_HeroMaxNumStr.ClearString();
        StringManager.Instance.IntToFormat((long)MaxNum, 1, true);
        this.m_HeroMaxNumStr.AppendFormat("{0}");
        this.m_HeroMaxNum.text = this.m_HeroMaxNumStr.ToString();
        for (int i = 0; i < 4; i++)
        {
            Skill   recordByKey2 = this.DM.SkillTable.GetRecordByKey(array2[i]);
            CString cstring      = StringManager.Instance.StaticString1024();
            cstring.ClearString();
            cstring.IntToFormat((long)recordByKey2.SkillIcon, 5, false);
            cstring.AppendFormat("s{0}");
            this.m_SkillImage[i].sprite   = this.GM.LoadSkillSprite(cstring);
            this.m_SkillImage[i].material = this.GM.GetSkillMaterial();
            this.m_SkillFrame[i].sprite   = this.GM.LoadFrameSprite("sk");
            this.m_SkillFrame[i].material = this.GM.GetFrameMaterial();
            this.m_SkliiNameText[i].text  = this.DM.mStringTable.GetStringByID((uint)recordByKey2.SkillName);
            this.m_SkillInfoStr[i].ClearString();
            float num = (float)recordByKey2.HurtValue + (float)((ushort)array[(int)(curHeroData.Star - 1)] * recordByKey2.HurtIncreaseValue) / 1000f;
            if (recordByKey2.HurtKind == 1)
            {
                GameConstants.GetEffectValue(this.m_SkillInfoStr[i], recordByKey2.HurtAddition, 0u, 7, 0f);
                this.m_SkillInfoStr[i].IntToFormat((long)((ushort)array[(int)(curHeroData.Star - 1)] * recordByKey2.HurtIncreaseValue), 1, false);
                this.m_SkillInfoStr[i].AppendFormat("{0}");
                this.m_SkillInfoText[i].text = this.m_SkillInfoStr[i].ToString();
            }
            else
            {
                if (recordByKey2.SkillType == 10)
                {
                    GameConstants.GetEffectValue(this.m_SkillInfoStr[i], recordByKey2.HurtAddition, (uint)num, 1, 0f);
                }
                else
                {
                    GameConstants.GetEffectValue(this.m_SkillInfoStr[i], recordByKey2.HurtAddition, 0u, 6, num * 100f);
                }
                this.m_SkillInfoText[i].text = this.m_SkillInfoStr[i].ToString();
            }
            if (curHeroData.SkillLV[i] == 0)
            {
                this.SetMaskColor(i, true);
                this.m_SkillMaskTf[i].gameObject.SetActive(true);
            }
            else
            {
                this.SetMaskColor(i, false);
                this.m_SkillMaskTf[i].gameObject.SetActive(false);
            }
        }
    }
Пример #25
0
 public void OnClickSetting()
 {
     GameConstants.PlaySoundClick();
     PopupManager.Instance.InitSeting();
 }
Пример #26
0
        internal static IEnumerable <SubrecordPinFrame> EnumerateSubrecords(ReadOnlyMemorySlice <byte> span, GameConstants meta, int loc, ICollection <RecordType> lengthOverflowTypes)
        {
            while (loc < span.Length)
            {
                var subFrame = new SubrecordPinFrame(meta, span.Slice(loc), loc);
                if (lengthOverflowTypes.Contains(subFrame.RecordType))
                { // Length overflow record
                    var nextLen = subFrame.AsUInt32();
                    loc += subFrame.TotalLength;
                    var nextSpan  = span.Slice(loc, checked ((int)(nextLen + meta.SubConstants.HeaderLength)));
                    var subHeader = new SubrecordHeader(meta, nextSpan);
                    yield return(SubrecordPinFrame.FactoryNoTrim(subHeader, nextSpan, loc));

                    loc += checked ((int)(subHeader.HeaderLength + nextLen));
                    continue;
                }
                yield return(subFrame);

                loc += subFrame.TotalLength;
            }
        }
Пример #27
0
 public void OnClickPause()
 {
     GameConstants.PlaySoundClick();
     OnPauseGame();
 }
Пример #28
0
    public void Update()
    {
        if (chunk == null)
        {
            return;
        }
        float t = Time.deltaTime * GameMaster.gameSpeed;

        timer -= t * consumingSpeed;
        if (timer <= 0)
        {
            if (realSpaceConsuming)
            {
                SpawnCube_BottomToUp();
            }
            else
            {
                SpawnCube_UpToDown();
            }
            timer = GameConstants.WORLD_CONSUMING_TIMER;
            if (consumingSpeed < 20f)
            {
                consumingSpeed += ACCUMULATION_SPEED * CONSUMING_MULTIPLIER;
            }
        }
        if (flyingCubes.Count > 0)
        {
            int         i = 0;
            FlyingBlock fb;
            Transform   tf;
            float       fspeed = FLY_SPEED * t;
            Vector3     one = Vector3.one * ROTATION_SPEED * t, up = Vector3.up * fspeed * t, down = Vector3.down * fspeed * t;
            float       upBorder = GameConstants.GetUpperBorder(), lowBorder = GameConstants.GetBottomBorder();

            while (i < flyingCubes.Count)
            {
                fb = flyingCubes[i];
                tf = fb.cube.transform;
                if (fb.goingUp)
                {
                    if (tf.position.y > upBorder)
                    {
                        fb.cube.SetActive(false);
                        fb.cube.transform.parent = transform;
                        cubesPool.Add(fb.cube);
                        flyingCubes.RemoveAt(i);
                        continue;
                    }
                    else
                    {
                        tf.position += up;
                    }
                }
                else
                {
                    if (tf.position.y < lowBorder)
                    {
                        fb.cube.SetActive(false);
                        fb.cube.transform.parent = transform;
                        cubesPool.Add(fb.cube);
                        flyingCubes.RemoveAt(i);
                        continue;
                    }
                    else
                    {
                        tf.position += down;
                    }
                }

                tf.Rotate(one);
                i++;
            }
        }
    }
Пример #29
0
    // Token: 0x0600181D RID: 6173 RVA: 0x0028B48C File Offset: 0x0028968C
    public void SetPushToSDK(bool pause)
    {
        if (!pause)
        {
            PushManage.ClearPush();
            return;
        }
        if (!PushManage.PushStart)
        {
            return;
        }
        if (NewbieManager.IsNewbie)
        {
            return;
        }
        if (PushManage.checkPushSwitch(0, 0))
        {
            long num = DataManager.Instance.queueBarData[0].StartTime + (long)((ulong)DataManager.Instance.queueBarData[0].TotalTime);
            if (num > DataManager.Instance.ServerTime)
            {
                num -= DataManager.Instance.ServerTime;
                this.SetPush(0, DataManager.Instance.mStringTable.GetStringByID(8440u), (int)num);
            }
            num = DataManager.Instance.queueBarData[1].StartTime + (long)((ulong)DataManager.Instance.queueBarData[1].TotalTime);
            if (num > DataManager.Instance.ServerTime)
            {
                num -= DataManager.Instance.ServerTime;
                this.SetPush(1, DataManager.Instance.mStringTable.GetStringByID(8441u), (int)num);
            }
            num = DataManager.Instance.queueBarData[10].StartTime + (long)((ulong)DataManager.Instance.queueBarData[10].TotalTime);
            if (num > DataManager.Instance.ServerTime)
            {
                num -= DataManager.Instance.ServerTime;
                this.SetPush(2, DataManager.Instance.mStringTable.GetStringByID(8445u), (int)num);
            }
            num = DataManager.Instance.queueBarData[14].StartTime + (long)((ulong)DataManager.Instance.queueBarData[14].TotalTime);
            if (num > DataManager.Instance.ServerTime)
            {
                num -= DataManager.Instance.ServerTime;
                this.SetPush(3, DataManager.Instance.mStringTable.GetStringByID(8446u), (int)num);
            }
            num = DataManager.Instance.queueBarData[18].StartTime + (long)((ulong)DataManager.Instance.queueBarData[18].TotalTime);
            if (num > DataManager.Instance.ServerTime)
            {
                num -= DataManager.Instance.ServerTime;
                this.SetPush(4, DataManager.Instance.mStringTable.GetStringByID(8455u), (int)num);
            }
            for (int i = 0; i < PetManager.Instance.m_PetTrainingData.Length; i++)
            {
                num = PetManager.Instance.m_PetTrainingData[i].m_EventTime.BeginTime + (long)((ulong)PetManager.Instance.m_PetTrainingData[i].m_EventTime.RequireTime);
                if (num > DataManager.Instance.ServerTime)
                {
                    num -= DataManager.Instance.ServerTime;
                    this.SetPush(15 + i, DataManager.Instance.mStringTable.GetStringByID(16077u), (int)num);
                }
            }
            num = DataManager.Instance.queueBarData[34].StartTime + (long)((ulong)DataManager.Instance.queueBarData[34].TotalTime);
            if (num > DataManager.Instance.ServerTime)
            {
                num -= DataManager.Instance.ServerTime;
                if (DataManager.Instance.FusionDataTable.GetRecordByKey(PetManager.Instance.ItemCraftID).Fusion_Kind == 0)
                {
                    this.SetPush(23, DataManager.Instance.mStringTable.GetStringByID(16095u), (int)num);
                }
                else
                {
                    this.SetPush(23, DataManager.Instance.mStringTable.GetStringByID(16096u), (int)num);
                }
            }
        }
        if (PushManage.checkPushSwitch(3, 15) && GUIManager.Instance.BuildingData.GetBuildData(8, 0).Level >= 3 && DataManager.Instance.RoleAttr.NextOnlineGiftOpenTime > DataManager.Instance.ServerTime)
        {
            long num = DataManager.Instance.RoleAttr.NextOnlineGiftOpenTime - DataManager.Instance.ServerTime;
            this.SetPush(5, DataManager.Instance.mStringTable.GetStringByID(8451u), (int)num);
        }
        if (PushManage.checkPushSwitch(4, 16))
        {
            int num2 = (int)(DataManager.Instance.HeroMaxMorale - DataManager.Instance.RoleAttr.Morale);
            if (num2 > 0)
            {
                long num3 = DataManager.Instance.ServerTime - DataManager.Instance.RoleAttr.LastMoraleRecoverTime;
                int  num4 = num2;
                if (num3 % 360L > 0L)
                {
                    num4--;
                }
                long num = (long)(num4 * 360) + num3;
                this.SetPush(6, DataManager.Instance.mStringTable.GetStringByID(8453u), (int)num);
            }
            uint maxMonsterPoint = DataManager.Instance.GetMaxMonsterPoint();
            num2 = (int)(DataManager.Instance.GetMaxMonsterPoint() - DataManager.Instance.RoleAttr.MonsterPoint);
            if (num2 > 0)
            {
                long num = (long)((DataManager.Instance.GetMaxMonsterPoint() - DataManager.Instance.RoleAttr.MonsterPoint) * ((double)DataManager.Instance.RoleAttr.MonsterPointRecoverFrequency / 1000.0));
                this.SetPush(7, DataManager.Instance.mStringTable.GetStringByID(8467u), (int)num);
            }
        }
        if (PushManage.checkPushSwitch(5, 17))
        {
            int recvBuffDataIdxByID = DataManager.Instance.GetRecvBuffDataIdxByID(1);
            if (recvBuffDataIdxByID >= 0)
            {
                ItemBuffData itemBuffData = DataManager.Instance.m_RecvItemBuffData[recvBuffDataIdxByID];
                long         num          = itemBuffData.TargetTime - DataManager.Instance.ServerTime - 600L;
                if (num > 0L)
                {
                    this.SetPush(8, DataManager.Instance.mStringTable.GetStringByID(8462u), (int)num);
                }
            }
        }
        if (PushManage.checkPushSwitch(11, 20))
        {
            long num = DataManager.Instance.m_CryptData.startTime + (long)((ulong)GameConstants.CryptSecends[(int)DataManager.Instance.m_CryptData.kind]) - DataManager.Instance.ServerTime;
            if (num > 0L)
            {
                this.SetPush(9, DataManager.Instance.mStringTable.GetStringByID(9040u), (int)num);
            }
        }
        if (PushManage.checkPushSwitch(10, 21))
        {
            TimeEventDataType shelterTime = HideArmyManager.Instance.GetShelterTime();
            long num = shelterTime.BeginTime + (long)((ulong)shelterTime.RequireTime) - DataManager.Instance.ServerTime - 600L;
            if (num > 0L)
            {
                this.SetPush(10, DataManager.Instance.mStringTable.GetStringByID(9048u), (int)num);
            }
        }
        if (PushManage.checkNewByteSwitch(22))
        {
            TimerTypeMission timerMissionData = DataManager.MissionDataManager.GetTimerMissionData(_eMissionType.Affair);
            long             num = timerMissionData.ResetTime - DataManager.Instance.ServerTime;
            if (GUIManager.Instance.BuildingData.GetBuildData(8, 0).Level >= 13 && num > 0L)
            {
                this.SetPush(13, DataManager.Instance.mStringTable.GetStringByID(9632u), (int)num);
            }
        }
        if (PushManage.checkPushSwitch(8, 11))
        {
            TimeEventDataType wonderCountTime = GUIManager.Instance.WonderCountTime;
            long num = wonderCountTime.BeginTime + (long)((ulong)wonderCountTime.RequireTime) - DataManager.Instance.ServerTime - 600L;
            if (ActivityManager.Instance.KvKActivityData[4].EventState == EActivityState.EAS_Prepare)
            {
                long num5 = ActivityManager.Instance.KvKActivityData[4].EventBeginTime - DataManager.Instance.ServerTime - 600L;
                if (num5 > 0L)
                {
                    this.SetPush(12, DataManager.Instance.mStringTable.GetStringByID(9548u), (int)num5);
                }
                if (num > 0L && num < num5)
                {
                    this.SetPush(11, DataManager.Instance.mStringTable.GetStringByID(9029u), (int)num);
                }
            }
            else if (num > 0L)
            {
                this.SetPush(11, DataManager.Instance.mStringTable.GetStringByID(9029u), (int)num);
            }
        }
        if (PushManage.checkNewByteSwitch(25))
        {
            long num = this.OrderEventBeginTime - DataManager.Instance.ServerTime - 600L;
            if (num > 0L)
            {
                this.SetPush(14, DataManager.Instance.mStringTable.GetStringByID(9694u), (int)num);
            }
        }
        RoleBuildingData buildData = GUIManager.Instance.BuildingData.GetBuildData(8, 0);
        ushort           num6      = 0;

        while ((int)num6 < DataManager.Instance.PushCallBackTable.TableCount)
        {
            PushCallBack recordByIndex = DataManager.Instance.PushCallBackTable.GetRecordByIndex((int)num6);
            if (GameConstants.IsBetween((int)buildData.Level, (int)recordByIndex.LowLevel, (int)recordByIndex.HighLevel))
            {
                int num7 = 10171 + UnityEngine.Random.Range(0, 4);
                if (num7 > 10174)
                {
                    num7 = 10174;
                }
                this.SetPush(24, DataManager.Instance.mStringTable.GetStringByID((uint)((ushort)num7)), (int)recordByIndex.Hour * 3600);
                break;
            }
            num6 += 1;
        }
        if (PushManage.checkNewByteSwitch(26))
        {
            if (this.FootBallGameType == 15)
            {
                long num = this.FootBallEventBeginTime - ActivityManager.Instance.ServerEventTime - 600L;
                if (num > 0L)
                {
                    this.SetPush(25, DataManager.Instance.mStringTable.GetStringByID(16123u), (int)num);
                }
                int num8 = Math.Min(6, (int)this.FootBallWaveCount);
                for (int j = 1; j < num8; j++)
                {
                    num += (long)this.FootBallWaveGap;
                    if (num > 0L)
                    {
                        this.SetPush(25 + j, DataManager.Instance.mStringTable.GetStringByID(16125u), (int)num);
                    }
                }
            }
            else if (this.FootBallGameType == 16)
            {
                EActivityState fifastate = ActivityManager.Instance.GetFIFAState();
                if (fifastate == EActivityState.EAS_Prepare || fifastate == EActivityState.EAS_Run)
                {
                    long num  = this.FootBallEventBeginTime - ActivityManager.Instance.ServerEventTime - 600L;
                    int  num9 = Math.Min(6, (int)this.FootBallWaveCount);
                    for (int k = 1; k < num9; k++)
                    {
                        num += (long)this.FootBallWaveGap;
                        if (num > 0L)
                        {
                            this.SetPush(25 + k, DataManager.Instance.mStringTable.GetStringByID(16125u), (int)num);
                        }
                    }
                }
            }
        }
    }
Пример #30
0
        public static void do_devote(CharacterInstance ch, string argument)
        {
            if (CheckFunctions.CheckIfNpc(ch, ch, "Huh?"))
            {
                return;
            }
            if (CheckFunctions.CheckIfTrue(ch, ch.Level < GameConstants.GetSystemValue <int>("MinimumDevotionLevel"),
                                           "You are not yet prepared for such devotion."))
            {
                return;
            }

            var firstArg = argument.FirstWord();

            if (CheckFunctions.CheckIfEmptyString(ch, firstArg, "Devote yourself to which deity?"))
            {
                return;
            }

            if (firstArg.EqualsIgnoreCase("none"))
            {
                RemoveDevotion((PlayerInstance)ch);
                return;
            }

            var deity = RepositoryManager.Instance.GetEntity <DeityData>(firstArg);

            if (CheckFunctions.CheckIfNullObject(ch, deity, "No such deity holds weight on this world."))
            {
                return;
            }
            if (CheckFunctions.CheckIfNotNullObject(ch, ((PlayerInstance)ch).PlayerData.CurrentDeity,
                                                    "You are already devoted to a deity."))
            {
                return;
            }
            if (CheckFunctions.CheckIfTrue(ch, WillDeityDenyPlayerClass(ch, deity),
                                           "That deity will not accept your worship due to your class."))
            {
                return;
            }
            if (CheckFunctions.CheckIfTrue(ch, WillDeityDenyPlayerGender(ch, deity),
                                           "That deity will not accept worshippers of your gender."))
            {
                return;
            }
            if (CheckFunctions.CheckIfTrue(ch, WillDeityDenyPlayerRace(ch, deity),
                                           "That deity will not accept worshippers of your race."))
            {
                return;
            }

            var pch = (PlayerInstance)ch;

            pch.PlayerData.CurrentDeity = deity;

            if (pch.PlayerData.Favor > deity.AffectedNum)
            {
                pch.AffectedBy.SetBits(deity.Affected);
            }
            if (pch.PlayerData.Favor > deity.ElementNum)
            {
                pch.Resistance.SetBit(deity.Element);
            }
            if (pch.PlayerData.Favor > deity.SusceptNum)
            {
                pch.Susceptibility.SetBit(deity.Suscept);
            }

            comm.act(ATTypes.AT_MAGIC, "Body and soul, you devote yourself to $t!", ch, deity.Name, null, ToTypes.Character);
            deity.Worshippers++;

            // TODO: Save deity worshipper data to database
            // save_deity( ch->pcdata->deity );

            save.save_char_obj(ch);
        }
Пример #31
0
        public static async Task OblivionESM_GroupMask_Import(TestingSettings settings, Target target)
        {
            var mod = OblivionMod.CreateFromBinary(
                new ModPath(
                    Mutagen.Bethesda.Oblivion.Constants.Oblivion,
                    Path.Combine(settings.DataFolderLocations.Oblivion, target.Path)),
                importMask: new Mutagen.Bethesda.Oblivion.GroupMask()
            {
                Npcs = true
            });

            using var tmp = TempFolder.FactoryByAddedPath("Mutagen_Oblivion_Binary_GroupMask_Import");
            var oblivionOutputPath = Path.Combine(tmp.Dir.Path, TestingConstants.OBLIVION_ESM);

            mod.WriteToBinary(oblivionOutputPath);
            var fileLocs = RecordLocator.GetFileLocations(oblivionOutputPath, constants: GameConstants.Get(GameRelease.Oblivion));

            using var reader = new BinaryReadStream(oblivionOutputPath);
            foreach (var rec in fileLocs.ListedRecords.Keys)
            {
                reader.Position = rec;
                var t = HeaderTranslation.ReadNextRecordType(reader);
                if (!t.Equals(Oblivion.Internals.RecordTypes.NPC_))
                {
                    throw new ArgumentException("Exported a non-NPC record.");
                }
            }
        }
Пример #32
0
    // Token: 0x06001DA8 RID: 7592 RVA: 0x0036F700 File Offset: 0x0036D900
    public override void UpdateNetwork(byte[] meg)
    {
        NetworkNews networkNews = (NetworkNews)meg[0];

        switch (networkNews)
        {
        case NetworkNews.Login:
        case NetworkNews.Refresh:
            break;

        default:
            if (networkNews != NetworkNews.Refresh_Mailing)
            {
                if (networkNews == NetworkNews.Refresh_FontTextureRebuilt)
                {
                    this.Refresh_FontTexture();
                }
            }
            else
            {
                if (meg[1] == 1 && meg[2] == 2)
                {
                    this.Favor.Serial = this.DM.GetMailboxReportSerial(ReportSubSet.REPORTSet_HELP);
                    this.Favor.Type   = this.DM.OpenMail.Type;
                    this.Favor.Kind   = this.DM.OpenMail.Kind;
                    if (!this.DM.MailReportGet(ref this.Favor) || this.Favor.Type != MailType.EMAIL_BATTLE)
                    {
                        this.door.CloseMenu(false);
                        return;
                    }
                    this.Report = this.Favor.Combat;
                    if (this.Report.UnSeen > 0)
                    {
                        this.DM.BattleReportRead(this.Report.SerialID, false);
                    }
                    this.text_Time[0].text = GameConstants.GetDateTime(this.Report.Times).ToString("MM/dd/yy");
                    this.text_Time[0].SetAllDirty();
                    this.text_Time[0].cachedTextGenerator.Invalidate();
                    this.text_Time[1].text = GameConstants.GetDateTime(this.Report.Times).ToString("HH:mm:ss");
                    this.text_Time[1].SetAllDirty();
                    this.text_Time[1].cachedTextGenerator.Invalidate();
                    this.tmplist.Clear();
                    this.tmplist.Add(101f);
                    this.mResourcesMax = this.DM.GetMailboxResourceSize();
                    for (int i = 0; i < this.mResourcesMax; i++)
                    {
                        this.tmplist.Add(101f);
                        this.tmpCR = this.DM.ResourceReportGet(this.mResourcesMax - (1 + i));
                        if (this.tmpCR != null && !this.tmpCR.BeRead)
                        {
                            this.UnReadNum++;
                        }
                    }
                    this.m_ScrollPanel.AddNewDataHeight(this.tmplist, false, true);
                }
                this.MaxLetterNum = (int)this.DM.GetMailboxSize(MailType.EMAIL_MAX);
                if (this.MaxLetterNum > 1)
                {
                    if (this.Report.Index + 1 == 1)
                    {
                        this.btn_Previous.gameObject.SetActive(false);
                    }
                    else
                    {
                        this.btn_Previous.gameObject.SetActive(true);
                    }
                    if ((int)(this.Report.Index + 1) == this.MaxLetterNum)
                    {
                        this.btn_Next.gameObject.SetActive(false);
                    }
                    else
                    {
                        this.btn_Next.gameObject.SetActive(true);
                    }
                }
                else
                {
                    this.btn_Previous.gameObject.SetActive(false);
                    this.btn_Next.gameObject.SetActive(false);
                }
                this.Cstr_Page.ClearString();
                MailType kind = this.DM.OpenMail.Kind;
                if (kind == MailType.EMAIL_BATTLE)
                {
                    this.Cstr_Page.IntToFormat((long)(this.Report.Index + 1), 1, false);
                    this.Cstr_Page.IntToFormat((long)this.MaxLetterNum, 1, false);
                }
                if (this.GUIM.IsArabic)
                {
                    this.Cstr_Page.AppendFormat("{1}/{0}");
                }
                else
                {
                    this.Cstr_Page.AppendFormat("{0}/{1}");
                }
                this.text_Page.text = this.Cstr_Page.ToString();
                this.text_Page.SetAllDirty();
                this.text_Page.cachedTextGenerator.Invalidate();
            }
            break;
        }
    }
Пример #33
0
    // Token: 0x060015C1 RID: 5569 RVA: 0x0024FD34 File Offset: 0x0024DF34
    protected override void UpdateNews(byte[] meg)
    {
        GAME_PLAYER_NEWS game_PLAYER_NEWS = (GAME_PLAYER_NEWS)meg[0];

        switch (game_PLAYER_NEWS)
        {
        case GAME_PLAYER_NEWS.ORIGIN_OpenStage:
            if (GUIManager.Instance.m_WindowStack.Count == 0)
            {
                if (DataManager.StageDataController._stageMode == StageMode.Corps)
                {
                    this.doorController.OpenMenu(EGUIWindow.UI_StageSelect2, (int)((DataManager.Instance.lastBattleResult != 1) ? (DataManager.StageDataController.StageRecord[2] + 1) : DataManager.StageDataController.StageRecord[2]), 0, false);
                }
                else
                {
                    this.doorController.OpenMenu(EGUIWindow.UI_StageSelect, (int)DataManager.StageDataController.currentChapterID, 0, false);
                }
            }
            break;

        case GAME_PLAYER_NEWS.ORIGIN_OpenStageStory:
            if (meg[1] == 1)
            {
                this.doorController.CloseMenu(false);
            }
            if (DataManager.StageDataController._stageMode == StageMode.Corps)
            {
                this.doorController.OpenMenu(EGUIWindow.UI_StageStory, (int)((meg[1] != 1) ? (DataManager.StageDataController.StageRecord[2] + 1) : DataManager.StageDataController.StageRecord[2]), (int)meg[1], true);
            }
            else
            {
                this.doorController.OpenMenu(EGUIWindow.UI_StageStory, (int)DataManager.StageDataController.currentChapterID, (int)meg[1], true);
            }
            GUIManager.Instance.m_HUDMessage.MapHud.SkipMsg();
            break;

        case GAME_PLAYER_NEWS.ORIGIN_CloseStageStory:
            this.doorController.CloseMenu(false);
            DataManager.msgBuffer[0] = 16;
            this.worldController.Renew(DataManager.msgBuffer, null);
            break;

        case GAME_PLAYER_NEWS.ORIGIN_OpenStageInfo:
            this.doorController.OpenMenu(EGUIWindow.UI_StageInfo, 0, 0, true);
            break;

        case GAME_PLAYER_NEWS.ORIGIN_OpenPve:
            this.doorController.m_GroundInfo.OpenPvePanel(true, DataManager.StageDataController.StageRecord[2] + 1);
            break;

        case GAME_PLAYER_NEWS.ORIGIN_CameraStateWild:
            this.worldController.Renew(meg, null);
            break;

        case GAME_PLAYER_NEWS.ORIGIN_CloseNewTerritory:
            GUIManager.Instance.CloseMenu(EGUIWindow.UI_NewTerritory);
            if (NewbieManager.CheckGoldGuy())
            {
                NewbieManager.CheckTeach(ETeachKind.GOLDGUY, null, false);
            }
            else if (NewbieManager.CheckArmyHole(true))
            {
                NewbieManager.CheckTeach(ETeachKind.ARMY_HOLE, null, false);
            }
            else
            {
                NewbieManager.CheckGambleNormal();
            }
            this.worldController.WorldUIQueueLockRelease();
            this.worldController.WorldUIQueueLockRelease();
            break;

        case GAME_PLAYER_NEWS.ORIGIN_OpenUpWild:
            GUIManager.Instance.CloseCheckCrystalBox();
            GUIManager.Instance.CloseOKCancelBox();
            this.doorController.CloseMenu(true);
            DataManager.msgBuffer[0] = 21;
            this.worldController.Renew(DataManager.msgBuffer, null);
            break;

        default:
            switch (game_PLAYER_NEWS)
            {
            case GAME_PLAYER_NEWS.Network_Update:
                if (meg[1] == 43)
                {
                    this.doorController.ViewKingdom();
                }
                else if (meg[1] == 42 && DataManager.MapDataController.FocusKingdomID != DataManager.MapDataController.OtherKingdomData.kingdomID)
                {
                    DataManager.MapDataController.FocusKingdomID = DataManager.MapDataController.OtherKingdomData.kingdomID;
                    GUIManager.Instance.HideUILock(EUILock.Normal);
                    DataManager.MapDataController.gotoKingdomState = 0;
                }
                this.worldController.Renew(meg, null);
                return;

            case GAME_PLAYER_NEWS.HeroTalk_Close:
                if (NewbieManager.IsNewbie)
                {
                    NewbieManager.Get().NextStep();
                }
                Indemnify.UpdateNetwork(meg);
                return;
            }
            this.worldController.Renew(meg, null);
            break;

        case GAME_PLAYER_NEWS.ORIGIN_OpenBuild:
            GUIManager.Instance.BuildingData.OpenUI(GameConstants.ConvertBytesToUShort(meg, 1), this.doorController);
            DataManager.msgBuffer[0] = 23;
            this.worldController.Renew(DataManager.msgBuffer, null);
            break;

        case GAME_PLAYER_NEWS.ORIGIN_UpdateBuild:
            this.worldController.Renew(meg, null);
            break;

        case GAME_PLAYER_NEWS.ORIGIN_CloseBuild:
            this.doorController.CloseMenu(false);
            DataManager.msgBuffer[0] = 33;
            this.worldController.Renew(DataManager.msgBuffer, null);
            break;

        case GAME_PLAYER_NEWS.ORIGIN_ChangeStageMode:
            if (this.worldController && this.doorController)
            {
                UIStageSelect uistageSelect = GUIManager.Instance.FindMenu(EGUIWindow.UI_StageSelect) as UIStageSelect;
                if (uistageSelect)
                {
                    if (uistageSelect.NFlash.activeSelf)
                    {
                        meg[1] = 1;
                    }
                    else if (uistageSelect.EFlash.activeSelf)
                    {
                        meg[1] = 2;
                    }
                    else if (uistageSelect.AFlash.activeSelf)
                    {
                        meg[1] = 3;
                    }
                    this.worldController.Renew(meg, null);
                }
            }
            break;

        case GAME_PLAYER_NEWS.ORIGIN_OpenTreasureInfo:
            if (meg[1] == 1)
            {
                this.doorController.CloseMenu(false);
            }
            this.doorController.OpenMenu(EGUIWindow.UI_ChapterRewards, (int)DataManager.StageDataController.currentChapterID, (int)meg[1], true);
            break;

        case GAME_PLAYER_NEWS.ORIGIN_CloseTreasureInfo:
            this.doorController.CloseMenu(false);
            DataManager.msgBuffer[0] = 39;
            this.worldController.Renew(DataManager.msgBuffer, null);
            break;

        case GAME_PLAYER_NEWS.ORIGIN_SetCastleLevel:
            AssetManager.OriginSetCastleLevel(meg[1], meg[2]);
            break;

        case GAME_PLAYER_NEWS.ORIGIN_ShowUI:
            this.HideUI = 0;
            this.doorController.m_TopLayer.gameObject.SetActive(true);
            for (int i = 1; i < GUIManager.Instance.m_WindowsTransform.childCount; i++)
            {
                GUIManager.Instance.m_WindowsTransform.GetChild(i).gameObject.SetActive(true);
            }
            if (GUIManager.Instance.m_WindowStack.Count == 0)
            {
                if (DataManager.StageDataController._stageMode == StageMode.Corps)
                {
                    GUIWindow x = GUIManager.Instance.FindMenu(EGUIWindow.UI_StageSelect2);
                    if (x == null)
                    {
                        this.doorController.OpenMenu(EGUIWindow.UI_StageSelect2, (int)((DataManager.Instance.lastBattleResult != 1) ? (DataManager.StageDataController.StageRecord[2] + 1) : DataManager.StageDataController.StageRecord[2]), 0, false);
                    }
                }
                else
                {
                    GUIWindow x = GUIManager.Instance.FindMenu(EGUIWindow.UI_StageSelect);
                    if (x == null)
                    {
                        this.doorController.OpenMenu(EGUIWindow.UI_StageSelect, (int)DataManager.StageDataController.currentChapterID, 0, false);
                    }
                }
            }
            this.doorController.HideFightButton();
            break;

        case GAME_PLAYER_NEWS.ORIGIN_HideUI:
            this.HideUI = 1;
            this.doorController.m_TopLayer.gameObject.SetActive(false);
            for (int j = 1; j < GUIManager.Instance.m_WindowsTransform.childCount; j++)
            {
                GUIManager.Instance.m_WindowsTransform.GetChild(j).gameObject.SetActive(false);
            }
            break;

        case GAME_PLAYER_NEWS.ORIGIN_BackgroundEnable:
            if (this.worldController && !this.worldController.gameObject.activeSelf)
            {
                this.worldController.gameObject.SetActive(true);
                if (LandWalkerManager.alive)
                {
                    LandWalkerManager.Instance.enabled = true;
                }
                GameManager.RemoveObserver(0, 3, this);
            }
            break;

        case GAME_PLAYER_NEWS.ORIGIN_BackgroundDisable:
            if (this.worldController && this.worldController.gameObject.activeSelf)
            {
                this.worldController.gameObject.SetActive(false);
                if (LandWalkerManager.alive)
                {
                    LandWalkerManager.Instance.enabled = false;
                }
                GameManager.RegisterObserver(0, 3, this, 1);
            }
            break;

        case GAME_PLAYER_NEWS.ORIGIN_DoorFadeOut:
            if (this.doorController != null)
            {
                this.doorController.BeginFadeInOut();
            }
            break;

        case GAME_PLAYER_NEWS.ORIGIN_DoorFadeIn:
            if (this.doorController != null)
            {
                this.doorController.BeginFadeIn();
            }
            break;
        }
    }
Пример #34
0
 public Technology(GameConstants.TechnologyID id, int cost, GameConstants.TechnologyID[] requiredTechnology)
     : this(id, cost, false, requiredTechnology)
 {
 }
Пример #35
0
    // Token: 0x06001322 RID: 4898 RVA: 0x0021589C File Offset: 0x00213A9C
    public void UpdatRow_Boards(GameObject item, int dataIdx, int panelObjectIdx)
    {
        if (dataIdx == 0)
        {
            switch (UIFootBallBoard.SubBoardID)
            {
            case 16:
            {
                item.transform.GetChild(0).gameObject.SetActive(true);
                item.transform.GetChild(1).gameObject.SetActive(false);
                UIText component = item.transform.GetChild(0).GetChild(4).GetComponent <UIText>();
                component.text = DataManager.Instance.mStringTable.GetStringByID(7062u);
                component.SetAllDirty();
                component.cachedTextGenerator.Invalidate();
                component      = item.transform.GetChild(0).GetChild(5).GetComponent <UIText>();
                component.text = DataManager.Instance.mStringTable.GetStringByID(7094u);
                component.SetAllDirty();
                component.cachedTextGenerator.Invalidate();
                component      = item.transform.GetChild(0).GetChild(6).GetComponent <UIText>();
                component.text = DataManager.Instance.mStringTable.GetStringByID(9857u);
                component.SetAllDirty();
                component.cachedTextGenerator.Invalidate();
                break;
            }

            case 17:
            {
                item.transform.GetChild(0).gameObject.SetActive(true);
                item.transform.GetChild(1).gameObject.SetActive(false);
                UIText component = item.transform.GetChild(0).GetChild(4).GetComponent <UIText>();
                component.text = DataManager.Instance.mStringTable.GetStringByID(7062u);
                component.SetAllDirty();
                component.cachedTextGenerator.Invalidate();
                component      = item.transform.GetChild(0).GetChild(5).GetComponent <UIText>();
                component.text = DataManager.Instance.mStringTable.GetStringByID(7063u);
                component.SetAllDirty();
                component.cachedTextGenerator.Invalidate();
                component      = item.transform.GetChild(0).GetChild(6).GetComponent <UIText>();
                component.text = DataManager.Instance.mStringTable.GetStringByID(9858u);
                component.SetAllDirty();
                component.cachedTextGenerator.Invalidate();
                break;
            }

            case 18:
            {
                item.transform.GetChild(0).gameObject.SetActive(true);
                item.transform.GetChild(1).gameObject.SetActive(false);
                UIText component = item.transform.GetChild(0).GetChild(4).GetComponent <UIText>();
                component.text = DataManager.Instance.mStringTable.GetStringByID(7062u);
                component.SetAllDirty();
                component.cachedTextGenerator.Invalidate();
                component      = item.transform.GetChild(0).GetChild(5).GetComponent <UIText>();
                component.text = DataManager.Instance.mStringTable.GetStringByID(7063u);
                component.SetAllDirty();
                component.cachedTextGenerator.Invalidate();
                component      = item.transform.GetChild(0).GetChild(6).GetComponent <UIText>();
                component.text = DataManager.Instance.mStringTable.GetStringByID(9858u);
                component.SetAllDirty();
                component.cachedTextGenerator.Invalidate();
                break;
            }
            }
        }
        else
        {
            LeaderBoardManager.Instance.CheckNextPart(UIFootBallBoard.SubBoardID, (byte)dataIdx);
            item.transform.GetChild(0).gameObject.SetActive(false);
            item.transform.GetChild(1).gameObject.SetActive(true);
            this.SortTextArray[0, panelObjectIdx].ClearString();
            this.SortTextArray[0, panelObjectIdx].IntToFormat((long)dataIdx, 1, false);
            this.SortTextArray[0, panelObjectIdx].AppendFormat("{0}");
            UIText component = item.transform.GetChild(1).GetChild(4).GetComponent <UIText>();
            component.text = this.SortTextArray[0, panelObjectIdx].ToString();
            component.SetAllDirty();
            component.cachedTextGenerator.Invalidate();
            switch (UIFootBallBoard.SubBoardID)
            {
            case 16:
                this.SortTextArray[1, panelObjectIdx].ClearString();
                GameConstants.GetNameString(this.SortTextArray[1, panelObjectIdx], ((WorldRankingBoardUnitAlliance)LeaderBoardManager.Instance.Boards[(int)UIFootBallBoard.SubBoardID][dataIdx - 1]).KingdomID, LeaderBoardManager.Instance.Boards[(int)UIFootBallBoard.SubBoardID][dataIdx - 1].Name, LeaderBoardManager.Instance.Boards[(int)UIFootBallBoard.SubBoardID][dataIdx - 1].AlliaceTag, false);
                component      = item.transform.GetChild(1).GetChild(5).GetComponent <UIText>();
                component.text = this.SortTextArray[1, panelObjectIdx].ToString();
                component.SetAllDirty();
                component.cachedTextGenerator.Invalidate();
                break;

            case 17:
                this.SortTextArray[1, panelObjectIdx].ClearString();
                GameConstants.GetNameString(this.SortTextArray[1, panelObjectIdx], ((WorldRankingBoardUnit)LeaderBoardManager.Instance.Boards[(int)UIFootBallBoard.SubBoardID][dataIdx - 1]).KingdomID, LeaderBoardManager.Instance.Boards[(int)UIFootBallBoard.SubBoardID][dataIdx - 1].Name, LeaderBoardManager.Instance.Boards[(int)UIFootBallBoard.SubBoardID][dataIdx - 1].AlliaceTag, false);
                component      = item.transform.GetChild(1).GetChild(5).GetComponent <UIText>();
                component.text = this.SortTextArray[1, panelObjectIdx].ToString();
                component.SetAllDirty();
                component.cachedTextGenerator.Invalidate();
                break;

            case 18:
                this.SortTextArray[1, panelObjectIdx].ClearString();
                GameConstants.GetNameString(this.SortTextArray[1, panelObjectIdx], 0, LeaderBoardManager.Instance.Boards[(int)UIFootBallBoard.SubBoardID][dataIdx - 1].Name, LeaderBoardManager.Instance.Boards[(int)UIFootBallBoard.SubBoardID][dataIdx - 1].AlliaceTag, false);
                component      = item.transform.GetChild(1).GetChild(5).GetComponent <UIText>();
                component.text = this.SortTextArray[1, panelObjectIdx].ToString();
                component.SetAllDirty();
                component.cachedTextGenerator.Invalidate();
                break;
            }
            this.SortTextArray[2, panelObjectIdx].ClearString();
            item.transform.GetChild(1).GetChild(11).gameObject.SetActive(false);
            item.transform.GetChild(1).GetChild(12).gameObject.SetActive(false);
            item.transform.GetChild(1).GetChild(1).gameObject.SetActive(true);
            this.SortTextArray[2, panelObjectIdx].uLongToFormat(LeaderBoardManager.Instance.Boards[(int)UIFootBallBoard.SubBoardID][dataIdx - 1].Value, 1, true);
            this.SortTextArray[2, panelObjectIdx].AppendFormat("{0}");
            component      = item.transform.GetChild(1).GetChild(6).GetComponent <UIText>();
            component.text = this.SortTextArray[2, panelObjectIdx].ToString();
            component.SetAllDirty();
            component.cachedTextGenerator.Invalidate();
            UIButton component2 = item.transform.GetChild(1).GetChild(10).GetComponent <UIButton>();
            component2.m_Handler = this;
            component2.m_BtnID1  = 4;
            component2.m_BtnID2  = dataIdx - 1;
            if (dataIdx == (int)LeaderBoardManager.Instance.MyRank[(int)UIFootBallBoard.SubBoardID])
            {
                UISpritesArray component3 = item.transform.GetChild(1).GetChild(0).GetComponent <UISpritesArray>();
                component3.SetSpriteIndex(2);
                component3 = item.transform.GetChild(1).GetChild(1).GetComponent <UISpritesArray>();
                component3.SetSpriteIndex(2);
                component3 = item.transform.GetChild(1).GetChild(2).GetComponent <UISpritesArray>();
                component3.SetSpriteIndex(2);
            }
            else if (dataIdx % 2 == 0)
            {
                UISpritesArray component3 = item.transform.GetChild(1).GetChild(0).GetComponent <UISpritesArray>();
                component3.SetSpriteIndex(1);
                component3 = item.transform.GetChild(1).GetChild(1).GetComponent <UISpritesArray>();
                component3.SetSpriteIndex(1);
                component3 = item.transform.GetChild(1).GetChild(2).GetComponent <UISpritesArray>();
                component3.SetSpriteIndex(1);
            }
            else
            {
                UISpritesArray component3 = item.transform.GetChild(1).GetChild(0).GetComponent <UISpritesArray>();
                component3.SetSpriteIndex(0);
                component3 = item.transform.GetChild(1).GetChild(1).GetComponent <UISpritesArray>();
                component3.SetSpriteIndex(0);
                component3 = item.transform.GetChild(1).GetChild(2).GetComponent <UISpritesArray>();
                component3.SetSpriteIndex(0);
            }
        }
    }
Пример #36
0
 // Token: 0x06001396 RID: 5014 RVA: 0x0022E154 File Offset: 0x0022C354
 public override void UpDateRowItem(GameObject item, int dataIdx, int panelObjectIdx, int panelId)
 {
     if (dataIdx == 0)
     {
         item.transform.GetChild(0).gameObject.SetActive(true);
         item.transform.GetChild(1).gameObject.SetActive(false);
         UIText component = item.transform.GetChild(0).GetChild(4).GetComponent <UIText>();
         component.text = DataManager.Instance.mStringTable.GetStringByID(7062u);
         component.SetAllDirty();
         component.cachedTextGenerator.Invalidate();
         component      = item.transform.GetChild(0).GetChild(5).GetComponent <UIText>();
         component.text = DataManager.Instance.mStringTable.GetStringByID(4717u);
         component.SetAllDirty();
         component.cachedTextGenerator.Invalidate();
         component      = item.transform.GetChild(0).GetChild(6).GetComponent <UIText>();
         component.text = DataManager.Instance.mStringTable.GetStringByID(11011u);
         component.SetAllDirty();
         component.cachedTextGenerator.Invalidate();
     }
     else
     {
         item.transform.GetChild(0).gameObject.SetActive(false);
         item.transform.GetChild(1).gameObject.SetActive(true);
         item.transform.GetChild(1).GetChild(11).gameObject.SetActive(false);
         item.transform.GetChild(1).GetChild(12).gameObject.SetActive(false);
         this.SortTextArray[0, panelObjectIdx].ClearString();
         this.SortTextArray[0, panelObjectIdx].IntToFormat((long)dataIdx, 1, false);
         this.SortTextArray[0, panelObjectIdx].AppendFormat("{0}");
         UIText component = item.transform.GetChild(1).GetChild(4).GetComponent <UIText>();
         component.text = this.SortTextArray[0, panelObjectIdx].ToString();
         component.SetAllDirty();
         component.cachedTextGenerator.Invalidate();
         this.SortTextArray[1, panelObjectIdx].ClearString();
         GameConstants.GetNameString(this.SortTextArray[1, panelObjectIdx], LeaderBoardManager.Instance.NobileBoard[dataIdx - 1].HomeKingdomID, LeaderBoardManager.Instance.NobileBoard[dataIdx - 1].Name, LeaderBoardManager.Instance.NobileBoard[dataIdx - 1].AllianceTag, true);
         component      = item.transform.GetChild(1).GetChild(5).GetComponent <UIText>();
         component.text = this.SortTextArray[1, panelObjectIdx].ToString();
         component.SetAllDirty();
         component.cachedTextGenerator.Invalidate();
         this.SortTextArray[2, panelObjectIdx].ClearString();
         GameConstants.GetTimeString(this.SortTextArray[2, panelObjectIdx], LeaderBoardManager.Instance.NobileBoard[dataIdx - 1].OccupyTime, false, false, true, false, true);
         component           = item.transform.GetChild(1).GetChild(6).GetComponent <UIText>();
         component.text      = this.SortTextArray[2, panelObjectIdx].ToString();
         component.alignment = TextAnchor.MiddleCenter;
         component.SetAllDirty();
         component.cachedTextGenerator.Invalidate();
         if (dataIdx % 2 == 0)
         {
             UISpritesArray component2 = item.transform.GetChild(1).GetChild(0).GetComponent <UISpritesArray>();
             component2.SetSpriteIndex(1);
             component2 = item.transform.GetChild(1).GetChild(1).GetComponent <UISpritesArray>();
             component2.SetSpriteIndex(1);
             component2 = item.transform.GetChild(1).GetChild(2).GetComponent <UISpritesArray>();
             component2.SetSpriteIndex(1);
         }
         else
         {
             UISpritesArray component2 = item.transform.GetChild(1).GetChild(0).GetComponent <UISpritesArray>();
             component2.SetSpriteIndex(0);
             component2 = item.transform.GetChild(1).GetChild(1).GetComponent <UISpritesArray>();
             component2.SetSpriteIndex(0);
             component2 = item.transform.GetChild(1).GetChild(2).GetComponent <UISpritesArray>();
             component2.SetSpriteIndex(0);
         }
         UIButton component3 = item.transform.GetChild(1).GetChild(10).GetComponent <UIButton>();
         component3.m_Handler = this;
         component3.m_BtnID1  = 10;
         component3.m_BtnID2  = dataIdx - 1;
     }
 }
Пример #37
0
    // Token: 0x0600131D RID: 4893 RVA: 0x002142E4 File Offset: 0x002124E4
    public void CreateTopBoard()
    {
        this.SPHeight.Clear();
        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(true);
        this.AGS_Form.GetChild(12).GetComponent <UISpritesArray>().SetSpriteIndex(0);
        UIFootBallBoard.isTopBoard = true;
        if (!UIFootBallBoard.WorldBoard)
        {
            this.AGS_Form.GetChild(12).gameObject.SetActive(false);
            UIText component = this.AGS_Form.GetChild(1).GetChild(0).GetComponent <UIText>();
            component.text = DataManager.Instance.mStringTable.GetStringByID(16116u);
            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.FootBallTopBoard.SortTime).ToString("MM/dd/yy HH:mm"));
            cstring2.ClearString();
            cstring2.Append(GameConstants.GetDateTime(LeaderBoardManager.Instance.FootBallTopBoard.SortTime + (long)((ulong)LeaderBoardManager.Instance.FootBallTopBoard.EventRequireTime)).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();
        }
        else
        {
            this.AGS_Form.GetChild(12).GetComponent <UISpritesArray>().SetSpriteIndex(1);
            UIText component2 = this.AGS_Form.GetChild(1).GetChild(0).GetComponent <UIText>();
            component2.text = DataManager.Instance.mStringTable.GetStringByID(16116u);
            this.AGS_Form.GetChild(2).gameObject.SetActive(true);
            this.AGS_Form.GetChild(5).gameObject.SetActive(true);
            component2 = this.AGS_Form.GetChild(5).GetComponent <UIText>();
            CString cstring3 = StringManager.Instance.StaticString1024();
            CString cstring4 = StringManager.Instance.StaticString1024();
            cstring3.ClearString();
            cstring3.Append(GameConstants.GetDateTime(LeaderBoardManager.Instance.FootBallTopBoard.SortTime).ToString("MM/dd/yy HH:mm"));
            cstring4.ClearString();
            cstring4.Append(GameConstants.GetDateTime(LeaderBoardManager.Instance.FootBallTopBoard.SortTime + (long)((ulong)LeaderBoardManager.Instance.FootBallTopBoard.EventRequireTime)).ToString("MM/dd/yy HH:mm"));
            this.Ranking.ClearString();
            this.Ranking.Append(DataManager.Instance.mStringTable.GetStringByID(8153u));
            this.Ranking.Append(" ");
            this.Ranking.Append(cstring3);
            this.Ranking.Append(" ~ ");
            this.Ranking.Append(cstring4);
            component2.text = this.Ranking.ToString();
            component2.SetAllDirty();
            component2.cachedTextGenerator.Invalidate();
        }
    }
Пример #38
0
 public void OnClickPlay()
 {
     GameConstants.PlaySoundClick();
     OnResumeGame();
 }
Пример #39
0
    // Token: 0x06001321 RID: 4897 RVA: 0x00215068 File Offset: 0x00213268
    public void UpdateRow_FunctionList(GameObject item, int dataIdx, int panelObjectIdx)
    {
        switch (dataIdx)
        {
        case 0:
        {
            item.transform.GetChild(2).gameObject.SetActive(LeaderBoardManager.Instance.FootBallTopBoard.KingdomAllianceTopEmblem != 0);
            item.transform.GetChild(3).gameObject.SetActive(false);
            if (item.transform.GetChild(2).GetChild(0).childCount < 1)
            {
                GUIManager.Instance.InitBadgeTotem(item.transform.GetChild(2).GetChild(0), LeaderBoardManager.Instance.FootBallTopBoard.KingdomAllianceTopEmblem);
            }
            else
            {
                GUIManager.Instance.SetBadgeTotemImg(item.transform.GetChild(2).GetChild(0), LeaderBoardManager.Instance.FootBallTopBoard.KingdomAllianceTopEmblem);
            }
            UIText component = item.transform.GetChild(4).GetComponent <UIText>();
            component.text = DataManager.Instance.mStringTable.GetStringByID(16117u);
            this.SortTextArray[1, panelObjectIdx].ClearString();
            if (LeaderBoardManager.Instance.FootBallTopBoard.KingdomAlliance.Value == 0UL)
            {
                this.SortTextArray[1, panelObjectIdx].Append(DataManager.Instance.mStringTable.GetStringByID(8477u));
            }
            else
            {
                GameConstants.GetNameString(this.SortTextArray[1, panelObjectIdx], LeaderBoardManager.Instance.FootBallTopBoard.KingdomAlliance.KingdomID, LeaderBoardManager.Instance.FootBallTopBoard.KingdomAlliance.Name, LeaderBoardManager.Instance.FootBallTopBoard.KingdomAlliance.AlliaceTag, false);
            }
            component      = item.transform.GetChild(5).GetComponent <UIText>();
            component.text = this.SortTextArray[1, panelObjectIdx].ToString();
            component.SetAllDirty();
            component.cachedTextGenerator.Invalidate();
            this.SortTextArray[2, panelObjectIdx].ClearString();
            if (LeaderBoardManager.Instance.FootBallTopBoard.KingdomAlliance.Value > 0UL)
            {
                this.SortTextArray[2, panelObjectIdx].uLongToFormat(LeaderBoardManager.Instance.FootBallTopBoard.KingdomAlliance.Value, 1, true);
                this.SortTextArray[2, panelObjectIdx].AppendFormat("{0}");
            }
            component      = item.transform.GetChild(6).GetComponent <UIText>();
            component.text = this.SortTextArray[2, panelObjectIdx].ToString();
            component.SetAllDirty();
            component.cachedTextGenerator.Invalidate();
            UIButton component2 = item.transform.GetChild(1).GetComponent <UIButton>();
            component2.m_Handler = this;
            component2.m_BtnID1  = 3;
            component2.m_BtnID2  = 16;
            break;
        }

        case 1:
        {
            item.transform.GetChild(2).gameObject.SetActive(false);
            item.transform.GetChild(3).gameObject.SetActive(LeaderBoardManager.Instance.FootBallTopBoard.KingdomPlayer.Value != 0UL);
            if (item.transform.GetChild(3).childCount < 1)
            {
                GUIManager.Instance.InitianHeroItemImg(item.transform.GetChild(3), eHeroOrItem.Hero, LeaderBoardManager.Instance.FootBallTopBoard.KingdomPlayerTopHead, 11, 0, 0, false, false, true, false);
            }
            else
            {
                GUIManager.Instance.ChangeHeroItemImg(item.transform.GetChild(3), eHeroOrItem.Hero, LeaderBoardManager.Instance.FootBallTopBoard.KingdomPlayerTopHead, 11, 0, 0);
            }
            UIText component = item.transform.GetChild(4).GetComponent <UIText>();
            component.text = DataManager.Instance.mStringTable.GetStringByID(16118u);
            this.SortTextArray[1, panelObjectIdx].ClearString();
            if (LeaderBoardManager.Instance.FootBallTopBoard.KingdomPlayer.Value == 0UL)
            {
                this.SortTextArray[1, panelObjectIdx].Append(DataManager.Instance.mStringTable.GetStringByID(8475u));
            }
            else
            {
                GameConstants.GetNameString(this.SortTextArray[1, panelObjectIdx], LeaderBoardManager.Instance.FootBallTopBoard.KingdomPlayer.KingdomID, LeaderBoardManager.Instance.FootBallTopBoard.KingdomPlayer.Name, LeaderBoardManager.Instance.FootBallTopBoard.KingdomPlayer.AlliaceTag, false);
            }
            component      = item.transform.GetChild(5).GetComponent <UIText>();
            component.text = this.SortTextArray[1, panelObjectIdx].ToString();
            component.SetAllDirty();
            component.cachedTextGenerator.Invalidate();
            this.SortTextArray[2, panelObjectIdx].ClearString();
            if (LeaderBoardManager.Instance.FootBallTopBoard.KingdomPlayer.Value > 0UL)
            {
                this.SortTextArray[2, panelObjectIdx].uLongToFormat(LeaderBoardManager.Instance.FootBallTopBoard.KingdomPlayer.Value, 1, true);
                this.SortTextArray[2, panelObjectIdx].AppendFormat("{0}");
            }
            component      = item.transform.GetChild(6).GetComponent <UIText>();
            component.text = this.SortTextArray[2, panelObjectIdx].ToString();
            component.SetAllDirty();
            component.cachedTextGenerator.Invalidate();
            UIButton component2 = item.transform.GetChild(1).GetComponent <UIButton>();
            component2.m_Handler = this;
            component2.m_BtnID1  = 3;
            component2.m_BtnID2  = 17;
            break;
        }

        case 2:
        {
            item.transform.GetChild(2).gameObject.SetActive(false);
            item.transform.GetChild(3).gameObject.SetActive(LeaderBoardManager.Instance.FootBallTopBoard.AlliancePlayer.Name.Length > 0 && DataManager.Instance.RoleAlliance.Id != 0u);
            if (item.transform.GetChild(3).childCount < 1)
            {
                GUIManager.Instance.InitianHeroItemImg(item.transform.GetChild(3), eHeroOrItem.Hero, LeaderBoardManager.Instance.FootBallTopBoard.AlliancePlayerTopHead, 11, 0, 0, false, false, true, false);
            }
            else
            {
                GUIManager.Instance.ChangeHeroItemImg(item.transform.GetChild(3), eHeroOrItem.Hero, LeaderBoardManager.Instance.FootBallTopBoard.AlliancePlayerTopHead, 11, 0, 0);
            }
            UIText component = item.transform.GetChild(4).GetComponent <UIText>();
            component.text = DataManager.Instance.mStringTable.GetStringByID(16119u);
            this.SortTextArray[1, panelObjectIdx].ClearString();
            if (DataManager.Instance.RoleAlliance.Id == 0u || LeaderBoardManager.Instance.FootBallTopBoard.AlliancePlayer.Name.Length == 0)
            {
                this.SortTextArray[1, panelObjectIdx].Append(DataManager.Instance.mStringTable.GetStringByID(8475u));
            }
            else
            {
                GameConstants.GetNameString(this.SortTextArray[1, panelObjectIdx], 0, LeaderBoardManager.Instance.FootBallTopBoard.AlliancePlayer.Name, DataManager.Instance.RoleAlliance.Tag, false);
            }
            component      = item.transform.GetChild(5).GetComponent <UIText>();
            component.text = this.SortTextArray[1, panelObjectIdx].ToString();
            component.SetAllDirty();
            component.cachedTextGenerator.Invalidate();
            this.SortTextArray[2, panelObjectIdx].ClearString();
            if (DataManager.Instance.RoleAlliance.Id > 0u && LeaderBoardManager.Instance.FootBallTopBoard.AlliancePlayer.Name.Length > 0)
            {
                this.SortTextArray[2, panelObjectIdx].uLongToFormat(LeaderBoardManager.Instance.FootBallTopBoard.AlliancePlayer.Value, 1, true);
                this.SortTextArray[2, panelObjectIdx].AppendFormat("{0}");
            }
            component      = item.transform.GetChild(6).GetComponent <UIText>();
            component.text = this.SortTextArray[2, panelObjectIdx].ToString();
            component.SetAllDirty();
            component.cachedTextGenerator.Invalidate();
            UIButton component2 = item.transform.GetChild(1).GetComponent <UIButton>();
            component2.m_Handler = this;
            component2.m_BtnID1  = 3;
            component2.m_BtnID2  = 18;
            break;
        }
        }
    }
Пример #40
0
 public bool HasTechnology(GameConstants.TechnologyID technologyID)
 {
     return researchedTechnology[(int)technologyID];
 }
Пример #41
0
        private async Task OnCreateNewCharacter(IPacket packet)
        {
            var name      = packet.Decode <string>();
            var race      = (Race)packet.Decode <int>();
            var subJob    = packet.Decode <short>();
            var face      = packet.Decode <int>();
            var hair      = packet.Decode <int>();
            var hairColor = packet.Decode <int>();
            var skin      = packet.Decode <int>();
            var coat      = packet.Decode <int>();
            var pants     = packet.Decode <int>();
            var shoes     = packet.Decode <int>();
            var weapon    = packet.Decode <int>();
            var gender    = packet.Decode <byte>();

            try
            {
                await Service.LockProvider.AcquireAsync("creationLock");

                using var p     = new Packet(SendPacketOperations.CreateNewCharacterResult);
                using var store = Service.DataStore.OpenSession();
                var character = new Character
                {
                    AccountDataID = AccountData.ID,
                    Name          = name,
                    Job           = GameConstants.GetStartJob(race),
                    Face          = face,
                    Hair          = hair + hairColor,
                    Skin          = (byte)skin,
                    Gender        = gender,
                    FieldID       = GameConstants.GetStartField(race),
                    FieldPortal   = 0,
                    Level         = 1,
                    HP            = 50,
                    MaxHP         = 50,
                    MP            = 50,
                    MaxMP         = 50,
                    SubJob        = (short)(race == Race.Normal ? subJob : 0)
                };
                var result       = LoginResultCode.Success;
                var templates    = Service.TemplateManager;
                var makeCharInfo = templates
                                   .GetAll <MakeCharInfoTemplate>()
                                   .First(
                    i => i.Type == (race switch {
                    Race.Normal => MakeCharInfoType.Normal,
                    Race.Cygnus => MakeCharInfoType.Premium,
                    Race.Aran => MakeCharInfoType.Orient,
                    Race.Evan => MakeCharInfoType.Evan,
                    Race.Resistance => MakeCharInfoType.Resistance,
                    _ => throw new ArgumentOutOfRangeException()
                }
                                    ) &&
                    i.Gender == gender);

                if (makeCharInfo.Face.All(i => i != face) ||
                    makeCharInfo.Hair.All(i => i != hair) ||
                    makeCharInfo.HairColor.All(i => i != hairColor) ||
                    makeCharInfo.Skin.All(i => i != skin) ||
                    makeCharInfo.Coat.All(i => i != coat) ||
                    makeCharInfo.Pants.All(i => i != pants) ||
                    makeCharInfo.Shoes.All(i => i != shoes) ||
                    makeCharInfo.Weapon.All(i => i != weapon)
                    )
                {
                    result = LoginResultCode.Unknown;
                }

                p.Encode <byte>((byte)result);

                if (result == LoginResultCode.Success)
                {
                    var context = new ModifyInventoriesContext(character.Inventories);

                    context.Set(-5, templates.Get <ItemTemplate>(coat));
                    context.Set(-7, templates.Get <ItemTemplate>(shoes));
                    context.Set(-11, templates.Get <ItemTemplate>(weapon));
                    if (pants > 0)
                    {
                        context.Set(-6, templates.Get <ItemTemplate>(pants));
                    }

                    await store.InsertAsync(character);

                    Logger.Debug($"Created new {race} character, {name}");

                    character.EncodeStats(p);
                    character.EncodeLook(p);
                    p.Encode <bool>(false);
                    p.Encode <bool>(false);
                }
                else
                {
                    p.Encode <int>(0);
                }

                await SendPacket(p);
            }
Пример #42
0
 public bool HasTechnology(GameConstants.TechnologyID technologyID)
 {
     return technologyManager.HasTechnology(technologyID);
 }
Пример #43
0
 public Portrait(string name, string image, GameConstants.eGender gender, GameConstants.eArchetype archetype)
 {
     this.name = name;
     this.image = image;
     this.gender = gender;
     this.archetype = archetype;
 }