Exemplo n.º 1
0
    public void _SetComponetBasic()
    {
        UIBaseFileManager instance = NrTSingleton <UIBaseFileManager> .Instance;

        instance.CreateCloseButton(ref this.closeButton, UIDataManager.closeButtonName, base.Scale);
        this.m_lbWorldMap_Title       = (base.GetControl("LB_Title") as Label);
        this.m_dtWorldMap_Map         = (base.GetControl("DT_map") as DrawTexture);
        this.m_dtLocalMap_Map         = (base.GetControl("DT_AreaBG") as DrawTexture);
        this.m_dtLocalMap_Day         = (base.GetControl("DT_Day") as DrawTexture);
        this.m_dtLocalMap_Day.Visible = false;
        this.m_dtLocalMap_Night       = (base.GetControl("DT_Night") as DrawTexture);
        this.m_dtLocalMap_Night.SetLocation(this.m_dtLocalMap_Night.GetLocationX(), this.m_dtLocalMap_Night.GetLocationY(), -0.004f);
        this.m_dtLocalMap_Night.Visible     = false;
        this.m_btLocalMap_ReWorld           = (base.GetControl("BT_WorldMap") as Button);
        this.m_btLocalMap_ReWorld.EffectAni = false;
        Button expr_F2 = this.m_btLocalMap_ReWorld;

        expr_F2.Click           = (EZValueChangedDelegate)Delegate.Combine(expr_F2.Click, new EZValueChangedDelegate(this.OnClickLocalMapReWorld));
        this.m_btLocalMap_Night = (base.GetControl("BT_Night") as Button);
        Button expr_12F = this.m_btLocalMap_Night;

        expr_12F.Click        = (EZValueChangedDelegate)Delegate.Combine(expr_12F.Click, new EZValueChangedDelegate(this.OnClickLocalMapNight));
        this.m_btLocalMap_Day = (base.GetControl("BT_Day") as Button);
        Button expr_16C = this.m_btLocalMap_Day;

        expr_16C.Click = (EZValueChangedDelegate)Delegate.Combine(expr_16C.Click, new EZValueChangedDelegate(this.OnClickLocalMapDay));
        this.m_btLocalMap_NpcAutoMove = (base.GetControl("BT_NpcAutoMove") as Button);
        Button expr_1A9 = this.m_btLocalMap_NpcAutoMove;

        expr_1A9.Click = (EZValueChangedDelegate)Delegate.Combine(expr_1A9.Click, new EZValueChangedDelegate(this.OnClickLocalMapNpcAutoMove));
        this.m_btLocalMap_NpcAutoMove.EffectAni = false;
        this.m_btUser_User = (base.GetControl("BT_UserBG") as Button);
        this.m_btUser_User.controlIsEnabled = false;
        this.m_dtUser_Icon = (base.GetControl("DT_UserImg") as DrawTexture);
        NrMyCharInfo myCharInfo = NrTSingleton <NkCharManager> .Instance.GetMyCharInfo();

        Texture2D texture2D = null;

        if (myCharInfo != null)
        {
            int num      = myCharInfo.GetFaceCharKind();
            int solgrade = (int)myCharInfo.GetFaceSolGrade();
            if (num == 0)
            {
                NrCharUser nrCharUser = NrTSingleton <NkCharManager> .Instance.GetChar(1) as NrCharUser;

                if (nrCharUser != null)
                {
                    NkSoldierInfo soldierInfo = nrCharUser.GetPersonInfoUser().GetSoldierInfo(0);
                    if (soldierInfo != null && soldierInfo.IsValid())
                    {
                        num      = soldierInfo.GetCharKind();
                        solgrade = (int)soldierInfo.GetGrade();
                    }
                }
            }
            if (myCharInfo.UserPortrait)
            {
                texture2D = myCharInfo.UserPortraitTexture;
            }
            if (texture2D != null)
            {
                this.m_dtUser_Icon.SetTexture(texture2D);
            }
            else
            {
                string costumePortraitPath = NrTSingleton <NrCharCostumeTableManager> .Instance.GetCostumePortraitPath(myCharInfo.GetFaceCostumeUnique());

                this.m_dtUser_Icon.SetTexture(eCharImageType.SMALL, num, solgrade, costumePortraitPath);
            }
        }
        this.m_btUser_User.Visible = false;
        this.m_dtUser_Icon.Visible = false;
        this.m_WorldMapInfo        = NrTSingleton <NrBaseTableManager> .Instance.GetWorldMapInfo("1");

        if (this.m_WorldMapInfo == null)
        {
            return;
        }
        this.m_MaxLocalMapCount = NrTSingleton <NrBaseTableManager> .Instance.GetLocalMapCount();

        this.m_btWorldMap_AreaIcon = new UIButton[this.m_MaxLocalMapCount];
        this.m_lbWorldMap_AreaName = new Label[this.m_MaxLocalMapCount];
        this.m_pkCharMapInfo       = NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.m_kCharMapInfo;
        this.m_selectLocalMap      = NrTSingleton <NrBaseTableManager> .Instance.GetLocalMapInfoFromMapIndex(this.m_pkCharMapInfo.m_nMapIndex);

        if (this.m_selectLocalMap == null)
        {
            this.Close();
            return;
        }
        string textFromInterface = NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface(this.m_selectLocalMap.LOCALMAP_NAME_TEXT_INDEX);

        this.m_lbWorldMap_Title.SetText(textFromInterface);
        this.m_dtLocalMap_Map.SetTextureFromBundle(this.m_selectLocalMap.GetBundlePath());
        MAP_INFO mapInfo = NrTSingleton <NrBaseTableManager> .Instance.GetMapInfo(this.m_pkCharMapInfo.m_nMapIndex.ToString());

        if (mapInfo != null && mapInfo.MAP_NIGHTMODE == 1)
        {
            this.m_bNowNightMode = true;
        }
        string name  = string.Empty;
        string name2 = string.Empty;

        this.m_btLocalMap_AreaIcon = new UIButton[20];
        this.m_lbLocalMap_AreaName = new Label[20];
        for (int i = 0; i < 20; i++)
        {
            name  = "BT_LocalMapAreaIcon" + i.ToString();
            name2 = "LB_LocalMapAreaName" + i.ToString();
            this.m_btLocalMap_AreaIcon[i] = UICreateControl.Button(name, "Main_B_Map", 64f, 64f);
            this.m_lbLocalMap_AreaName[i] = UICreateControl.Label(name2, null, false, 280f, 28f, SpriteText.Font_Effect.Black_Shadow_Small, SpriteText.Anchor_Pos.Middle_Center, SpriteText.Alignment_Type.Left, Color.white);
            if (null != this.m_btLocalMap_AreaIcon[i])
            {
                this.m_btLocalMap_AreaIcon[i].Data = 0;
                this.m_btLocalMap_AreaIcon[i].SetSize(64f, 64f);
                this.m_btLocalMap_AreaIcon[i].Start();
                this.m_btLocalMap_AreaIcon[i].UseDefaultSound = false;
                this.m_lbLocalMap_AreaName[i].Visible         = false;
                base.InteractivePanel.MakeChild(this.m_btLocalMap_AreaIcon[i].gameObject);
                base.InteractivePanel.MakeChild(this.m_lbLocalMap_AreaName[i].gameObject);
            }
        }
        for (int j = 0; j < 20; j++)
        {
            this.m_pTreasure[j] = new TreasureData();
            this.m_pTreasure[j].Init(j);
            this.m_pTreasure[j].TreasureShow(false);
            if (this.m_pTreasure[j].GetTexture())
            {
                base.InteractivePanel.MakeChild(this.m_pTreasure[j].GetTexture().gameObject);
            }
            if (this.m_pTreasure[j].GetDrawTexture())
            {
                base.InteractivePanel.MakeChild(this.m_pTreasure[j].GetDrawTexture().gameObject);
            }
        }
        this.SetLocalMapTitle();
        this.SetLocalMapMapIcon();
        for (int k = 0; k < this.m_MaxLocalMapCount; k++)
        {
            int           num2         = k + 1;
            LOCALMAP_INFO localMapInfo = NrTSingleton <NrBaseTableManager> .Instance.GetLocalMapInfo(num2.ToString());

            if (localMapInfo != null)
            {
                if (localMapInfo.LOCALMAP_IDX == num2)
                {
                    if (localMapInfo != null)
                    {
                        name  = "BT_WorldMapAreaIcon" + k.ToString();
                        name2 = "LB_WorldMapAreaName" + k.ToString();
                        this.m_btWorldMap_AreaIcon[k]           = UICreateControl.Button(name, localMapInfo.LOCALMAP_ICON, 64f, 64f);
                        this.m_btWorldMap_AreaIcon[k].EffectAni = false;
                        string textFromInterface2 = NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface(localMapInfo.LOCALMAP_NAME_TEXT_INDEX);

                        this.m_lbWorldMap_AreaName[k] = UICreateControl.Label(name2, NrTSingleton <CTextParser> .Instance.GetTextColor("1002") + textFromInterface2, false, 280f, 28f, SpriteText.Font_Effect.Black_Shadow_Small, SpriteText.Anchor_Pos.Middle_Center, SpriteText.Alignment_Type.Left, Color.white);
                        if (null != this.m_btWorldMap_AreaIcon[k])
                        {
                            this.m_btWorldMap_AreaIcon[k].AddValueChangedDelegate(new EZValueChangedDelegate(this.OnClickWorldMapToLocalArea));
                            this.m_btWorldMap_AreaIcon[k].SetLocation(localMapInfo.LOCALMAP_X + 20f, localMapInfo.LOCALMAP_Y + 64f);
                            this.m_btWorldMap_AreaIcon[k].Data = localMapInfo.LOCALMAP_IDX;
                            this.m_lbWorldMap_AreaName[k].SetLocation(localMapInfo.LOCALMAP_X + 20f + -107f, localMapInfo.LOCALMAP_Y + 64f + 84f);
                            base.InteractivePanel.MakeChild(this.m_btWorldMap_AreaIcon[k].gameObject);
                            base.InteractivePanel.MakeChild(this.m_lbWorldMap_AreaName[k].gameObject);
                        }
                        this.m_btWorldMap_AreaIcon[k].Start();
                        if (!NrTSingleton <ContentsLimitManager> .Instance.IsWorldMapMove(num2))
                        {
                            this.m_btWorldMap_AreaIcon[k].Hide(true);
                            this.m_lbWorldMap_AreaName[k].Hide(true);
                        }
                    }
                }
            }
        }
        base.SetScreenCenter();
        this.ShowLocalMap(true);
        this.SetUserIcon();
    }