Exemple #1
0
    public override bool ParseDataFromNDT(TsDataReader dr)
    {
        foreach (TsDataReader.Row data in dr)
        {
            BountyInfoData bountyInfoData = new BountyInfoData();
            bountyInfoData.SetData(data);
            bountyInfoData.i32NPCCharKind = NrTSingleton <NrCharKindInfoManager> .Instance.GetCharKindByCode(bountyInfoData.strNPCCharCode);

            NrTSingleton <BountyHuntManager> .Instance.AddBountyInfoData(bountyInfoData);
        }
        return(true);
    }
    public bool IsBountyHuntNextEpisode(short iBountyHuntUnique)
    {
        BountyInfoData bountyInfoDataFromUnique = this.GetBountyInfoDataFromUnique(iBountyHuntUnique);

        if (bountyInfoDataFromUnique == null)
        {
            return(false);
        }
        if (bountyInfoDataFromUnique.i16Episode == 1)
        {
            return(true);
        }
        short oldBountyHuntUnique = NrTSingleton <BountyHuntManager> .Instance.GetOldBountyHuntUnique(iBountyHuntUnique);

        return(oldBountyHuntUnique != 0 && NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.IsBountyHuntClearUnique(oldBountyHuntUnique));
    }
 public bool AddBountyInfoData(BountyInfoData Data)
 {
     for (int i = 0; i < this.m_BountyInfoDataList.Count; i++)
     {
         if (Data.i16Week == this.m_BountyInfoDataList[i].i16Week && Data.i16Page == this.m_BountyInfoDataList[i].i16Page && Data.i16Episode == this.m_BountyInfoDataList[i].i16Episode)
         {
             this.m_BountyInfoDataList[i] = Data;
             return(true);
         }
     }
     this.m_BountyInfoDataList.Add(Data);
     if (Data.i16Page > this.m_MaxPage)
     {
         this.m_MaxPage = Data.i16Page;
     }
     return(true);
 }
    public short GetOldBountyHuntUnique(short iBountyHuntUnique)
    {
        short          result = 0;
        BountyInfoData bountyInfoDataFromUnique = this.GetBountyInfoDataFromUnique(iBountyHuntUnique);

        if (bountyInfoDataFromUnique != null)
        {
            for (int i = 0; i < this.m_BountyInfoDataList.Count; i++)
            {
                if (this.m_BountyInfoDataList[i].i16Unique < iBountyHuntUnique && this.m_BountyInfoDataList[i].i16Week == bountyInfoDataFromUnique.i16Week)
                {
                    result = this.m_BountyInfoDataList[i].i16Unique;
                }
            }
        }
        return(result);
    }
    public Vector3 FindFirstPath(short iBountyHuntUnique)
    {
        Vector3      result     = Vector3.zero;
        NrMyCharInfo myCharInfo = NrTSingleton <NkCharManager> .Instance.GetMyCharInfo();

        if (myCharInfo == null)
        {
            return(result);
        }
        int            mapIndex = myCharInfo.m_kCharMapInfo.MapIndex;
        BountyInfoData bountyInfoDataFromUnique = this.GetBountyInfoDataFromUnique(iBountyHuntUnique);

        if (bountyInfoDataFromUnique == null)
        {
            return(result);
        }
        if (bountyInfoDataFromUnique.i32MapIndex != mapIndex)
        {
            this.IsWarp(iBountyHuntUnique, bountyInfoDataFromUnique.i32MapIndex);
        }
        else
        {
            BountyHuntNPCInfo bountyHuntNPCInfo = this.GetNPCInfo((int)bountyInfoDataFromUnique.i16Unique);
            if (bountyHuntNPCInfo == null)
            {
                bountyHuntNPCInfo = this.UpdateClientNpc(bountyInfoDataFromUnique.i32MapIndex);
            }
            if (bountyHuntNPCInfo != null)
            {
                int        i32MapIndex = bountyInfoDataFromUnique.i32MapIndex;
                short      destX       = (short)bountyHuntNPCInfo.Pos.x;
                short      destY       = (short)bountyHuntNPCInfo.Pos.z;
                NrCharBase @char       = NrTSingleton <NkCharManager> .Instance.GetChar(1);

                if (@char != null && @char.m_kCharMove != null)
                {
                    result = @char.m_kCharMove.FindFirstPath(i32MapIndex, destX, destY, false);
                }
            }
        }
        NrTSingleton <FormsManager> .Instance.CloseForm(G_ID.BOUNTYHUNTING_DLG);

        return(result);
    }
    public void ClickEpisode(IUIObject obj)
    {
        Button button = obj as Button;

        if (null == button)
        {
            return;
        }
        BountyCheckDlg bountyCheckDlg = NrTSingleton <FormsManager> .Instance.LoadForm(G_ID.BOUNTYCHECK_DLG) as BountyCheckDlg;

        if (bountyCheckDlg != null)
        {
            BountyInfoData bountyInfoData = NrTSingleton <BountyHuntManager> .Instance.GetBountyInfoData(this.m_iPage, (short)button.TabIndex);

            if (bountyInfoData != null)
            {
                bountyCheckDlg.SetEpisode(bountyInfoData);
            }
        }
        this.SetCurEffect(false);
    }
    public bool GetBountyInfoDataTime(short iBountyHuntUnique)
    {
        BountyInfoData bountyInfoDataFromUnique = this.GetBountyInfoDataFromUnique(iBountyHuntUnique);

        if (bountyInfoDataFromUnique == null)
        {
            return(false);
        }
        DateTime dueDate = PublicMethod.GetDueDate(PublicMethod.GetCurTime());

        if ((short)dueDate.DayOfWeek == bountyInfoDataFromUnique.i16Week)
        {
            return(dueDate.Hour >= (int)bountyInfoDataFromUnique.i16Hour);
        }
        short num = bountyInfoDataFromUnique.i16Week + 1;

        if (num > 6)
        {
            num = 0;
        }
        return((short)dueDate.DayOfWeek == num && dueDate.Hour < (int)bountyInfoDataFromUnique.i16Hour);
    }
    public void SetEpisode(BountyInfoData Data)
    {
        if (Data == null)
        {
            return;
        }
        this.m_strText = string.Format("UI/Bounty/{0}", Data.strMonBG);
        this.m_dtBG.SetTextureFromBundle(this.m_strText);
        this.m_iBountyHuntUnique = Data.i16Unique;
        if (this.m_iBountyHuntUnique == NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.BountyHuntUnique)
        {
            this.m_btAccept.SetText(NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("2382"));
        }
        else
        {
            this.m_btAccept.SetText(NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("2327"));
        }
        byte bountyHuntClearRank = NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.GetBountyHuntClearRank(Data.i16Unique);

        if (0 < bountyHuntClearRank)
        {
            this.m_dtClearRank.Visible = true;
            this.m_dtClearRank.SetTexture(NrTSingleton <BountyHuntManager> .Instance.GetBountyRankImgText(bountyHuntClearRank));
            this.m_dtClearRankBG.Visible = true;
        }
        else
        {
            this.m_dtClearRank.Visible   = false;
            this.m_dtClearRankBG.Visible = false;
        }
        this.m_dtMonFaceBG.SetTexture(Data.strMonBG);
        NrCharKindInfo charKindInfo = NrTSingleton <NrCharKindInfoManager> .Instance.GetCharKindInfo(Data.i32NPCCharKind);

        if (charKindInfo != null)
        {
            this.m_lbMonsterName.SetText(charKindInfo.GetName());
        }
        this.m_dtMonFace.SetTexture(eCharImageType.LARGE, Data.i32NPCCharKind, 0, string.Empty);
        if (NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.IsBountyHuntClearUnique(Data.i16Unique))
        {
            this.m_btAccept.SetEnabled(false);
            this.m_lbReward.Visible  = false;
            this.m_lbReward2.Visible = false;
            this.m_lbClear.Visible   = true;
        }
        else
        {
            this.m_btAccept.SetEnabled(true);
            this.m_lbReward.Visible  = true;
            this.m_lbReward2.Visible = true;
            this.m_lbClear.Visible   = false;
            int  num  = Data.i32FirstRewardUnique;
            int  num2 = Data.i32FirstRewardNum;
            ITEM iTEM = new ITEM();
            iTEM.m_nItemUnique = num;
            iTEM.m_nItemNum    = num2;
            this.m_itRewardItem.SetItemTexture(iTEM);
            NrTSingleton <CTextParser> .Instance.ReplaceParam(ref this.m_strText, new object[]
            {
                NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("1697"),
                "itemname",
                NrTSingleton <ItemManager> .Instance.GetItemNameByItemUnique(num),
                "count",
                num2
            });

            this.m_lbReward.SetText(this.m_strText);
            num  = Data.i32RepeatRewardUnique;
            num2 = Data.i32RepeatRewardNum;
            if (num == 0)
            {
                this.m_itRewardItem2.Visible = false;
                this.m_lbReward2.Visible     = false;
            }
            else
            {
                ITEM iTEM2 = new ITEM();
                iTEM2.m_nItemUnique = num;
                iTEM2.m_nItemNum    = num2;
                this.m_itRewardItem2.SetItemTexture(iTEM2);
                NrTSingleton <CTextParser> .Instance.ReplaceParam(ref this.m_strText, new object[]
                {
                    NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("1697"),
                    "itemname",
                    NrTSingleton <ItemManager> .Instance.GetItemNameByItemUnique(num),
                    "count",
                    num2
                });

                this.m_lbReward2.SetText(this.m_strText);
            }
        }
    }
    private void ShowEpisod(short iPage)
    {
        this.m_iPage = iPage;
        short          bountyHuntUnique = NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.BountyHuntUnique;
        BountyInfoData bountyInfoData   = NrTSingleton <BountyHuntManager> .Instance.GetBountyInfoDataFromUnique(bountyHuntUnique);

        if (bountyInfoData != null && !NrTSingleton <BountyHuntManager> .Instance.GetBountyInfoDataTime(bountyHuntUnique))
        {
            NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.BountyHuntUnique = 0;
            NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.ClearBountyHuntClearInfo();
        }
        for (int i = 0; i < 4; i++)
        {
            this.m_dtDisableBG[i].SetTexture(this.m_strBGTextureKey);
            this.m_dtDisableMark[i].SetTexture(this.m_strNoneTextureKey);
            this.m_dtDisableMark[i].Visible   = true;
            this.m_dtDisableRank[i].Visible   = false;
            this.m_dtDisableRankBG[i].Visible = false;
            bountyInfoData = NrTSingleton <BountyHuntManager> .Instance.GetBountyInfoData(iPage, (short)(i + 1));

            if (bountyInfoData != null)
            {
                if (NrTSingleton <BountyHuntManager> .Instance.GetBountyEcoData(bountyInfoData.i16EcoIndex) != null)
                {
                    if (i == 0)
                    {
                        this.m_lbTitle.SetText(NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface(bountyInfoData.i32WeekTitleKey.ToString()));
                        this.m_strText = string.Format("UI/adventure/{0}", bountyInfoData.strWeekBG);
                        this.m_dtBG.SetTextureFromBundle(this.m_strText);
                    }
                    switch (NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.GetBountyHuntClearState(bountyInfoData.i16Unique))
                    {
                    case eBOUNTYHUNTCLEAR_STATE.eBOUNTYHUNTCLEAR_STATE_NONE:
                        this.m_dtDisableBG[i].SetTexture(this.m_strBGTextureKey);
                        this.m_dtDisableMark[i].SetTexture(this.m_strNoneTextureKey);
                        break;

                    case eBOUNTYHUNTCLEAR_STATE.eBOUNTYHUNTCLEAR_STATE_ACCEPT:
                        this.m_dtDisableBG[i].SetTexture(eCharImageType.SMALL, bountyInfoData.i32NPCCharKind, 0, string.Empty);
                        this.m_dtDisableMark[i].SetTexture(bountyInfoData.strMonBG);
                        break;

                    case eBOUNTYHUNTCLEAR_STATE.eBOUNTYHUNTCLEAR_STATE_CLEAR:
                    {
                        byte bountyHuntClearRank = NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.GetBountyHuntClearRank(bountyInfoData.i16Unique);

                        this.m_dtDisableBG[i].SetTexture(eCharImageType.SMALL, bountyInfoData.i32NPCCharKind, 0, string.Empty);
                        this.m_dtDisableMark[i].Visible = false;
                        UIBaseInfoLoader texture = NrTSingleton <UIImageInfoManager> .Instance.FindUIImageDictionary(NrTSingleton <BountyHuntManager> .Instance.GetBountyRankImgText(bountyHuntClearRank));

                        this.m_dtDisableRank[i].SetTexture(texture);
                        this.m_dtDisableRank[i].Visible   = true;
                        this.m_dtDisableRankBG[i].Visible = true;
                        break;
                    }
                    }
                    if (bountyInfoData.i16Unique == NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.BountyHuntUnique)
                    {
                        NrTSingleton <FormsManager> .Instance.AttachEffectKey("FX_UI_EMERGENCY", this.m_btEpisode[i], this.m_btEpisode[i].GetSize());

                        this.m_btEpisode[i].AddGameObjectDelegate(new EZGameObjectDelegate(this.ButtonAddEffectDelegate));
                        this.m_iCurIndex = i;
                    }
                }
            }
        }
        this.CheckPageButton((int)iPage);
    }
    public void RefreshSolInfo()
    {
        for (int i = 0; i < 4; i++)
        {
            this.user_info[i].Init();
        }
        this.SetLayer();
        NrCharBase @char = NrTSingleton <NkCharManager> .Instance.GetChar(1);

        string text  = string.Empty;
        string text2 = string.Empty;

        if (0 >= SoldierBatch.BABELTOWER_INFO.BountHuntUnique)
        {
            if (SoldierBatch.BABELTOWER_INFO.m_nBabelFloorType == 2)
            {
                text = NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("2787");
            }
            else
            {
                text = NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("833");
            }
            NrTSingleton <CTextParser> .Instance.ReplaceParam(ref text2, new object[]
            {
                text,
                "floor",
                SoldierBatch.BABELTOWER_INFO.m_nBabelFloor,
                "subfloor",
                (int)(SoldierBatch.BABELTOWER_INFO.m_nBabelSubFloor + 1)
            });
        }
        else
        {
            BountyInfoData bountyInfoDataFromUnique = NrTSingleton <BountyHuntManager> .Instance.GetBountyInfoDataFromUnique(SoldierBatch.BABELTOWER_INFO.BountHuntUnique);

            if (bountyInfoDataFromUnique != null)
            {
                text2 = NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface(bountyInfoDataFromUnique.i32WeekTitleKey.ToString());
            }
        }
        PlunderSolNumDlg plunderSolNumDlg = NrTSingleton <FormsManager> .Instance.GetForm(G_ID.PLUNDERSOLNUM_DLG) as PlunderSolNumDlg;

        if (plunderSolNumDlg != null)
        {
            plunderSolNumDlg.SetTitle(text2);
        }
        BABELTOWER_PERSON babelLeaderInfo = SoldierBatch.BABELTOWER_INFO.GetBabelLeaderInfo();

        if (babelLeaderInfo != null)
        {
            this.user_info[0].Show(true);
            this.user_info[0].PersonID = babelLeaderInfo.nPartyPersonID;
            text = NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("1639");

            NrTSingleton <CTextParser> .Instance.ReplaceParam(ref text2, new object[]
            {
                text,
                "count",
                babelLeaderInfo.nLevel.ToString(),
                "targetname",
                babelLeaderInfo.strCharName
            });

            this.user_info[0].m_laUserName.SetText(text2);
            for (int j = 0; j < 4; j++)
            {
                if (j != 0)
                {
                    BABELTOWER_PERSON babelPersonInfo = SoldierBatch.BABELTOWER_INFO.GetBabelPersonInfo(j);
                    if (babelPersonInfo != null)
                    {
                        if (babelPersonInfo.nPartyPersonID > 0L)
                        {
                            this.m_ddlSlotType[j].SetVisible(false);
                            this.user_info[j].Show(true);
                            this.user_info[j].PersonID = babelPersonInfo.nPartyPersonID;
                            NrTSingleton <CTextParser> .Instance.ReplaceParam(ref text2, new object[]
                            {
                                text,
                                "count",
                                babelPersonInfo.nLevel.ToString(),
                                "targetname",
                                babelPersonInfo.strCharName
                            });

                            this.user_info[j].m_laUserName.SetText(text2);
                            this.user_info[j].m_dtReady.Visible = babelPersonInfo.bReady;
                            if (babelPersonInfo.bReady)
                            {
                                this.user_info[j].m_laReady.Text = NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("662");
                            }
                            else
                            {
                                this.user_info[j].m_laReady.Text = string.Empty;
                            }
                            if (@char.GetPersonID() == babelLeaderInfo.nPartyPersonID || @char.GetPersonID() == babelPersonInfo.nPartyPersonID)
                            {
                                this.user_info[j].m_btKickUser.Data = j;
                                this.user_info[j].m_btKickUser.AddValueChangedDelegate(new EZValueChangedDelegate(this.OnClickKickUser));
                            }
                            else
                            {
                                this.user_info[j].m_btKickUser.Visible = false;
                            }
                        }
                        else
                        {
                            this.user_info[j].Show(false);
                            if (@char.GetPersonID() == babelLeaderInfo.nPartyPersonID)
                            {
                                this.user_info[j].SetSlotState(false, 0);
                                this.m_ddlSlotType[j].SetVisible(true);
                            }
                            else
                            {
                                this.user_info[j].SetSlotState(true, (int)babelPersonInfo.nSlotType);
                                this.m_ddlSlotType[j].SetVisible(false);
                            }
                        }
                    }
                }
            }
        }
        if (@char.GetPersonID() == babelLeaderInfo.nPartyPersonID)
        {
            if (SoldierBatch.BABELTOWER_INFO.IsCanBattle())
            {
                if (this.m_StartEffect == null)
                {
                }
            }
            else if (this.m_StartEffect != null)
            {
                UnityEngine.Object.DestroyImmediate(this.m_StartEffect);
            }
        }
        this.RefreshSolCount();
        this.RefreshPossibleLevel();
        if (!base.Visible)
        {
            this.Show();
        }
    }
    public BountyHuntNPCInfo UpdateClientNpc(int iMapIndex)
    {
        if (Scene.CurScene != Scene.Type.WORLD)
        {
            return(null);
        }
        if (iMapIndex == 0)
        {
            iMapIndex = NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.m_kCharMapInfo.m_nMapIndex;
        }
        for (int i = 0; i < this.m_ClientNpcList.Count; i++)
        {
            BountyHuntNPCInfo bountyHuntNPCInfo = this.m_ClientNpcList[i];
            if (bountyHuntNPCInfo != null)
            {
                NrTSingleton <NkCharManager> .Instance.DeleteChar(bountyHuntNPCInfo.CharID);
            }
        }
        this.m_ClientNpcList.Clear();
        BountyInfoData bountyInfoDataFromUnique = this.GetBountyInfoDataFromUnique(NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.BountyHuntUnique);

        if (bountyInfoDataFromUnique != null)
        {
            if (iMapIndex != bountyInfoDataFromUnique.i32MapIndex)
            {
                return(null);
            }
            if (!NrTSingleton <BountyHuntManager> .Instance.GetBountyInfoDataTime(bountyInfoDataFromUnique.i16Unique))
            {
                NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.BountyHuntUnique = 0;
                NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.ClearBountyHuntClearInfo();
            }
            else
            {
                NrCharKindInfo charKindInfo = NrTSingleton <NrCharKindInfoManager> .Instance.GetCharKindInfo(bountyInfoDataFromUnique.i32NPCCharKind);

                if (charKindInfo != null)
                {
                    int num = UnityEngine.Random.Range(0, 5);
                    NEW_MAKECHAR_INFO nEW_MAKECHAR_INFO = new NEW_MAKECHAR_INFO();
                    nEW_MAKECHAR_INFO.CharName  = TKString.StringChar(charKindInfo.GetName());
                    nEW_MAKECHAR_INFO.CharPos.x = bountyInfoDataFromUnique.fFixPosX[num];
                    nEW_MAKECHAR_INFO.CharPos.y = 0f;
                    nEW_MAKECHAR_INFO.CharPos.z = bountyInfoDataFromUnique.fFixPosZ[num];
                    int   num2 = bountyInfoDataFromUnique.iDirection[num];
                    float f    = (float)num2 * 0.0174532924f;
                    nEW_MAKECHAR_INFO.Direction.x  = 1f * Mathf.Sin(f);
                    nEW_MAKECHAR_INFO.Direction.y  = 0f;
                    nEW_MAKECHAR_INFO.Direction.z  = 1f * Mathf.Cos(f);
                    nEW_MAKECHAR_INFO.CharKind     = charKindInfo.GetCharKind();
                    nEW_MAKECHAR_INFO.CharKindType = 3;
                    nEW_MAKECHAR_INFO.CharUnique   = NrTSingleton <NkCharManager> .Instance.GetClientNpcUnique();

                    if (nEW_MAKECHAR_INFO.CharUnique == 0)
                    {
                        GS_BOUNTYHUNT_LOG_REQ gS_BOUNTYHUNT_LOG_REQ = new GS_BOUNTYHUNT_LOG_REQ();
                        gS_BOUNTYHUNT_LOG_REQ.i16BountyHuntUnique = bountyInfoDataFromUnique.i16Unique;
                        gS_BOUNTYHUNT_LOG_REQ.i32CharID           = (int)nEW_MAKECHAR_INFO.CharUnique;
                        gS_BOUNTYHUNT_LOG_REQ.i32MapIndex         = iMapIndex;
                        SendPacket.GetInstance().SendObject(1930, gS_BOUNTYHUNT_LOG_REQ);
                    }
                    int num3 = NrTSingleton <NkCharManager> .Instance.SetChar(nEW_MAKECHAR_INFO, false, false);

                    TsLog.LogOnlyEditor(string.Concat(new object[]
                    {
                        "BountyHunt UpdateClientNpc MapIndex : ",
                        iMapIndex,
                        " : ",
                        num3
                    }));
                    BountyHuntNPCInfo bountyHuntNPCInfo2 = new BountyHuntNPCInfo();
                    bountyHuntNPCInfo2.MapIndex         = iMapIndex;
                    bountyHuntNPCInfo2.CharID           = num3;
                    bountyHuntNPCInfo2.BountyHuntUnique = bountyInfoDataFromUnique.i16Unique;
                    bountyHuntNPCInfo2.Pos       = nEW_MAKECHAR_INFO.CharPos;
                    bountyHuntNPCInfo2.RandIndex = num;
                    this.m_ClientNpcList.Add(bountyHuntNPCInfo2);
                    return(bountyHuntNPCInfo2);
                }
            }
        }
        return(null);
    }