Пример #1
0
    public void ClickUseFullElixir(IUIObject obj)
    {
        if (!NrTSingleton <ContentsLimitManager> .Instance.IsWillSpend())
        {
            return;
        }
        NrMyCharInfo kMyCharInfo = NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo;

        if (kMyCharInfo != null)
        {
            long num = kMyCharInfo.m_nMaxActivityPoint - kMyCharInfo.m_nActivityPoint;
            if (num <= 0L)
            {
                string textFromNotify = NrTSingleton <NrTextMgr> .Instance.GetTextFromNotify("784");

                Main_UI_SystemMessage.ADDMessage(textFromNotify, SYSTEM_MESSAGE_TYPE.NAGATIVE_MESSAGE);
                return;
            }
            if (0 >= NkUserInventory.GetInstance().Get_First_ItemCnt(70005))
            {
                string empty = string.Empty;
                NrTSingleton <CTextParser> .Instance.ReplaceParam(ref empty, new object[]
                {
                    NrTSingleton <NrTextMgr> .Instance.GetTextFromNotify("168"),
                    "targetname",
                    NrTSingleton <ItemManager> .Instance.GetItemNameByItemUnique(70005)
                });

                Main_UI_SystemMessage.ADDMessage(empty, SYSTEM_MESSAGE_TYPE.NAGATIVE_MESSAGE);
                return;
            }
            ITEM item = NkUserInventory.GetInstance().GetItem(70005);
            if (item != null)
            {
                NrCharUser nrCharUser = NrTSingleton <NkCharManager> .Instance.GetChar(1) as NrCharUser;

                NkSoldierInfo          userSoldierInfo        = nrCharUser.GetUserSoldierInfo();
                long                   solID                  = userSoldierInfo.GetSolID();
                GS_ITEM_SUPPLY_USE_REQ gS_ITEM_SUPPLY_USE_REQ = new GS_ITEM_SUPPLY_USE_REQ();
                gS_ITEM_SUPPLY_USE_REQ.m_nItemUnique = item.m_nItemUnique;
                gS_ITEM_SUPPLY_USE_REQ.m_nDestSolID  = solID;
                if ((long)item.m_nItemNum < num)
                {
                    gS_ITEM_SUPPLY_USE_REQ.m_shItemNum = item.m_nItemNum;
                }
                else
                {
                    gS_ITEM_SUPPLY_USE_REQ.m_shItemNum = (int)num;
                }
                gS_ITEM_SUPPLY_USE_REQ.m_byPosType = item.m_nPosType;
                gS_ITEM_SUPPLY_USE_REQ.m_shPosItem = item.m_nItemPos;
                SendPacket.GetInstance().SendObject(eGAME_PACKET_ID.GS_ITEM_SUPPLY_USE_REQ, gS_ITEM_SUPPLY_USE_REQ);
            }
            NrTSingleton <FormsManager> .Instance.CloseForm(G_ID.WILLCHARGE_DLG);
        }
    }
Пример #2
0
    public void LevelUpAlarmUpdate()
    {
        if (!CommonTasks.IsEndOfPrework)
        {
            return;
        }
        if (NrTSingleton <FormsManager> .Instance.GetForm(G_ID.EXPLORATION_PLAY_DLG) != null)
        {
            return;
        }
        if (NrTSingleton <FormsManager> .Instance.GetForm(G_ID.EXPLORATION_REWARD_DLG) != null)
        {
            return;
        }
        if (NrTSingleton <FormsManager> .Instance.GetForm(G_ID.EXPLORATION_DLG) != null)
        {
            return;
        }
        if (NrTSingleton <FormsManager> .Instance.GetForm(G_ID.SOLCOMPOSE_GRADE_UP_SUCCESS_DLG) != null)
        {
            return;
        }
        if (NrTSingleton <FormsManager> .Instance.GetForm(G_ID.SOLCOMPOSE_SUCCESS_DLG) != null)
        {
            return;
        }
        if (this.m_SolIDList.Count == 0 && this.m_lstEventType.Count == 0)
        {
            return;
        }
        if (!NrTSingleton <NkClientLogic> .Instance.IsEffectEnable())
        {
            return;
        }
        NrCharUser nrCharUser = NrTSingleton <NkCharManager> .Instance.GetChar(1) as NrCharUser;

        if (nrCharUser == null)
        {
            return;
        }
        if (this.startLevel == 0)
        {
            this.startLevel = NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.GetLevel();
        }
        if (this.m_SolIDList.Count > 0)
        {
            if (NrTSingleton <FormsManager> .Instance.IsShow(G_ID.MAIN_UI_LEVELUP_ALARM_MONARCH) || NrTSingleton <FormsManager> .Instance.IsShow(G_ID.MAIN_UI_LEVELUP_ALARM_SOLDIER))
            {
                return;
            }
            this.m_SolIDList.Sort(new Comparison <long>(AlarmManager.CompareLevel));
            long             num        = this.m_SolIDList[0];
            NrPersonInfoBase personInfo = nrCharUser.GetPersonInfo();
            if (personInfo == null)
            {
                return;
            }
            NkSoldierInfo soldierInfoFromSolID = personInfo.GetSoldierInfoFromSolID(num);
            if (soldierInfoFromSolID == null)
            {
                return;
            }
            if (NrTSingleton <NrCharKindInfoManager> .Instance.GetCharKindInfo(soldierInfoFromSolID.GetCharKind()) == null)
            {
                return;
            }
            this.m_kSolInfo = soldierInfoFromSolID;
            if (num == nrCharUser.GetUserSoldierInfo().GetSolID())
            {
                this.ShowLevelUpAlarm1();
                this.m_SolIDList.RemoveAt(0);
                this.ShowLevelUpAlarm2();
            }
            else
            {
                this.ShowLevelUpSoldier();
                this.m_SolIDList.RemoveAt(0);
            }
        }
        if (this.m_SolIDList.Count == 0 && this.m_lstEventType.Count > 0)
        {
            if (NrTSingleton <FormsManager> .Instance.IsShow(G_ID.MAIN_UI_LEVELUP_ALARM_MONARCH) || NrTSingleton <FormsManager> .Instance.IsShow(G_ID.MAIN_UI_LEVELUP_ALARM_SOLDIER))
            {
                return;
            }
            this.m_nEventType        = this.m_lstEventType[0];
            this.m_nEventTitleText   = this.m_lstEventTitleText[0];
            this.m_nEventExplainText = this.m_lstEventExplainText[0];
            this.ShowEventAlarm();
            this.m_lstEventType.RemoveAt(0);
            this.m_lstEventTitleText.RemoveAt(0);
            this.m_lstEventExplainText.RemoveAt(0);
        }
    }
Пример #3
0
    public void OnClickUse(IUIObject obj)
    {
        if (this.m_eShowType == ItemBoxContinue_Dlg.SHOW_TYPE.ITEM_RANDOMBOX)
        {
            GS_BOX_USE_REQ gS_BOX_USE_REQ = new GS_BOX_USE_REQ();
            gS_BOX_USE_REQ.m_nItemID     = this.m_MainBoxItem.m_nItemID;
            gS_BOX_USE_REQ.m_nItemUnique = this.m_MainBoxItem.m_nItemUnique;
            gS_BOX_USE_REQ.m_nPosType    = this.m_MainBoxItem.m_nPosType;
            gS_BOX_USE_REQ.m_nItemPos    = this.m_MainBoxItem.m_nItemPos;
            gS_BOX_USE_REQ.m_nArrayIndex = 0;
            gS_BOX_USE_REQ.m_byAllOpen   = 1;
            gS_BOX_USE_REQ.m_nItemCount  = this.m_nItemOpenCount;
            SendPacket.GetInstance().SendObject(eGAME_PACKET_ID.GS_BOX_USE_REQ, gS_BOX_USE_REQ);
        }
        else if (this.m_eShowType == ItemBoxContinue_Dlg.SHOW_TYPE.ITEM_GOLDBAR || this.m_eShowType == ItemBoxContinue_Dlg.SHOW_TYPE.ITEM_EXCHANGE || this.m_eShowType == ItemBoxContinue_Dlg.SHOW_TYPE.ITEM_BATTLESPEED)
        {
            NrCharUser nrCharUser = NrTSingleton <NkCharManager> .Instance.GetChar(1) as NrCharUser;

            NkSoldierInfo userSoldierInfo = nrCharUser.GetUserSoldierInfo();
            long          solID           = userSoldierInfo.GetSolID();
            if (this.m_eShowType == ItemBoxContinue_Dlg.SHOW_TYPE.ITEM_BATTLESPEED && this.m_MaxCount <= 0f)
            {
                COMMON_CONSTANT_Manager instance = COMMON_CONSTANT_Manager.GetInstance();
                if (instance == null)
                {
                    return;
                }
                int    value          = instance.GetValue(eCOMMON_CONSTANT.eCOMMON_CONSTANT_FASTBATTLE_MAXNUM);
                string empty          = string.Empty;
                string textFromNotify = NrTSingleton <NrTextMgr> .Instance.GetTextFromNotify("801");

                NrTSingleton <CTextParser> .Instance.ReplaceParam(ref empty, new object[]
                {
                    textFromNotify,
                    "count",
                    value
                });

                Main_UI_SystemMessage.ADDMessage(empty, SYSTEM_MESSAGE_TYPE.NORMAL_MESSAGE);
                return;
            }
            else
            {
                GS_ITEM_SUPPLY_USE_REQ gS_ITEM_SUPPLY_USE_REQ = new GS_ITEM_SUPPLY_USE_REQ();
                gS_ITEM_SUPPLY_USE_REQ.m_nItemUnique = this.m_MainBoxItem.m_nItemUnique;
                gS_ITEM_SUPPLY_USE_REQ.m_nDestSolID  = solID;
                gS_ITEM_SUPPLY_USE_REQ.m_shItemNum   = this.m_nItemOpenCount;
                gS_ITEM_SUPPLY_USE_REQ.m_byPosType   = this.m_MainBoxItem.m_nPosType;
                gS_ITEM_SUPPLY_USE_REQ.m_shPosItem   = this.m_MainBoxItem.m_nItemPos;
                SendPacket.GetInstance().SendObject(eGAME_PACKET_ID.GS_ITEM_SUPPLY_USE_REQ, gS_ITEM_SUPPLY_USE_REQ);
                this.Close();
            }
        }
        else if (this.m_eShowType == ItemBoxContinue_Dlg.SHOW_TYPE.ITEM_TICKET)
        {
            if (!(obj.Data is ITEM))
            {
                return;
            }
            ITEM iTEM = obj.Data as ITEM;
            if (iTEM == null)
            {
                return;
            }
            NkReadySolList readySolList = NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.GetReadySolList();

            if (readySolList == null || readySolList.GetCount() >= 100)
            {
                string textFromNotify2 = NrTSingleton <NrTextMgr> .Instance.GetTextFromNotify("507");

                Main_UI_SystemMessage.ADDMessage(textFromNotify2, SYSTEM_MESSAGE_TYPE.NORMAL_MESSAGE);
                return;
            }
            if (NrTSingleton <ItemManager> .Instance.GetItemInfo(iTEM.m_nItemUnique) == null)
            {
                return;
            }
            SolRecruitDlg solRecruitDlg = NrTSingleton <FormsManager> .Instance.GetForm(G_ID.SOLRECRUIT_DLG) as SolRecruitDlg;

            if (solRecruitDlg != null)
            {
                solRecruitDlg.SetRecruitButtonEnable(false);
            }
            NrTSingleton <NkClientLogic> .Instance.SetCanOpenTicket(false);

            if (this.m_nItemOpenCount == 1)
            {
                Protocol_Item.Item_Use(iTEM);
                return;
            }
            GS_SOLDIER_RECRUIT_REQ gS_SOLDIER_RECRUIT_REQ = default(GS_SOLDIER_RECRUIT_REQ);
            gS_SOLDIER_RECRUIT_REQ.ItemUnique  = iTEM.m_nItemUnique;
            gS_SOLDIER_RECRUIT_REQ.RecruitType = 20;
            gS_SOLDIER_RECRUIT_REQ.SubData     = this.m_nItemOpenCount;
            SendPacket.GetInstance().SendObject(eGAME_PACKET_ID.GS_SOLDIER_RECRUIT_REQ, gS_SOLDIER_RECRUIT_REQ);
        }
    }