Exemple #1
0
    public void ExcuteTicket(int itemunique, int recruittype, int season, bool bForceRecruit)
    {
        int solCount = SolRecruitDlg.GetSolCount(recruittype);

        if (!bForceRecruit)
        {
            NkReadySolList readySolList = NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.GetReadySolList();

            if (readySolList == null || readySolList.GetCount() + solCount - 1 >= 100)
            {
                string textFromNotify = NrTSingleton <NrTextMgr> .Instance.GetTextFromNotify("507");

                Main_UI_SystemMessage.ADDMessage(textFromNotify, SYSTEM_MESSAGE_TYPE.NORMAL_MESSAGE);
                return;
            }
        }
        if (NkUserInventory.GetInstance().GetFirstItemByUnique(itemunique) == null)
        {
            string textFromNotify2 = NrTSingleton <NrTextMgr> .Instance.GetTextFromNotify("506");

            Main_UI_SystemMessage.ADDMessage(textFromNotify2, SYSTEM_MESSAGE_TYPE.NORMAL_MESSAGE);
            return;
        }
        NrTSingleton <NkClientLogic> .Instance.SetCanOpenTicket(false);

        this.SetRecruitButtonEnable(false);
        GS_SOLDIER_RECRUIT_REQ gS_SOLDIER_RECRUIT_REQ = default(GS_SOLDIER_RECRUIT_REQ);

        gS_SOLDIER_RECRUIT_REQ.ItemUnique  = itemunique;
        gS_SOLDIER_RECRUIT_REQ.RecruitType = recruittype;
        gS_SOLDIER_RECRUIT_REQ.SubData     = 0;
        SendPacket.GetInstance().SendObject(eGAME_PACKET_ID.GS_SOLDIER_RECRUIT_REQ, gS_SOLDIER_RECRUIT_REQ);
    }
Exemple #2
0
    public override bool CheckCondition(long i64Param, ref long i64ParamVal)
    {
        NrPersonInfoUser charPersonInfo = NrTSingleton <NkCharManager> .Instance.GetCharPersonInfo(1);

        if (charPersonInfo == null)
        {
            return(false);
        }
        NkReadySolList readySolList = NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.GetReadySolList();

        if (readySolList == null)
        {
            return(false);
        }
        int num = 0;

        for (int i = 0; i < 6; i++)
        {
            NkSoldierInfo soldierInfo = charPersonInfo.GetSoldierList().GetSoldierInfo(i);
            if (soldierInfo != null)
            {
                if (soldierInfo.GetSolID() != 0L)
                {
                    if (!soldierInfo.IsLeader())
                    {
                        num++;
                    }
                }
            }
        }
        num += readySolList.GetCount();
        return((long)num >= base.GetParamVal());
    }
Exemple #3
0
    public override bool CheckGameGuideOnce()
    {
        NrMyCharInfo myCharInfo = NrTSingleton <NkCharManager> .Instance.GetMyCharInfo();

        if (myCharInfo == null)
        {
            return(false);
        }
        if (this.m_nMinLevel > myCharInfo.GetLevel())
        {
            return(false);
        }
        UserChallengeInfo userChallengeInfo = myCharInfo.GetUserChallengeInfo();

        if (userChallengeInfo == null)
        {
            return(false);
        }
        Challenge_Info userChallengeInfo2 = userChallengeInfo.GetUserChallengeInfo(3050);

        if (userChallengeInfo2 == null)
        {
            return(false);
        }
        if (0L < userChallengeInfo2.m_nValue)
        {
            return(false);
        }
        NkReadySolList readySolList = NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.GetReadySolList();

        return(readySolList != null && 5 <= readySolList.GetCount() && 10000L <= myCharInfo.m_Money);
    }
Exemple #4
0
    public void SolTicketReOpen()
    {
        if (this.m_OpenTicket == null)
        {
            return;
        }
        NkReadySolList readySolList = NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.GetReadySolList();

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

            Main_UI_SystemMessage.ADDMessage(textFromNotify, SYSTEM_MESSAGE_TYPE.NORMAL_MESSAGE);
            return;
        }
        if (NrTSingleton <ItemManager> .Instance.GetItemInfo(this.m_OpenTicket.m_nItemUnique) == null)
        {
            return;
        }
        this.SetRecruitButtonEnable(false);
        GS_SOLDIER_RECRUIT_REQ gS_SOLDIER_RECRUIT_REQ = default(GS_SOLDIER_RECRUIT_REQ);

        gS_SOLDIER_RECRUIT_REQ.ItemUnique  = this.m_OpenTicket.m_nItemUnique;
        gS_SOLDIER_RECRUIT_REQ.RecruitType = 20;
        gS_SOLDIER_RECRUIT_REQ.SubData     = 0;
        SendPacket.GetInstance().SendObject(eGAME_PACKET_ID.GS_SOLDIER_RECRUIT_REQ, gS_SOLDIER_RECRUIT_REQ);
        this.SetShowReUseTicket(false);
    }
    private void SetItemTicket()
    {
        int value = COMMON_CONSTANT_Manager.GetInstance().GetValue(eCOMMON_CONSTANT.eCOMMON_CONSTANT_CARD_MULTIPLE_OPEN);

        this.m_MaxCount = (float)value;
        if (this.m_MainBoxItem.m_nItemNum < value)
        {
            this.m_MaxCount = (float)this.m_MainBoxItem.m_nItemNum;
        }
        NkReadySolList readySolList = NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.GetReadySolList();

        int num = 100 - readySolList.GetCount();

        if (num <= 0)
        {
            this.Close();
        }
        if ((float)num < this.m_MaxCount)
        {
            this.m_MaxCount = (float)num;
        }
        this.m_nItemOpenCount = (int)this.m_MaxCount;
        this.SetOpenItemNum(this.m_nItemOpenCount);
        this.m_btAllUse.data = this.m_MainBoxItem;
    }
Exemple #6
0
    private void ClickTicketSellInfo(IUIObject obj)
    {
        if (obj == null || obj.Data == null)
        {
            return;
        }
        if (this.m_fRequestTime > 0f && Time.time - this.m_fRequestTime < 1f)
        {
            string textFromNotify = NrTSingleton <NrTextMgr> .Instance.GetTextFromNotify("508");

            Main_UI_SystemMessage.ADDMessage(textFromNotify, SYSTEM_MESSAGE_TYPE.NORMAL_MESSAGE);
            return;
        }
        int            solCount     = SolRecruitDlg.GetSolCount(7);
        NkReadySolList readySolList = NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.GetReadySolList();

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

            Main_UI_SystemMessage.ADDMessage(textFromNotify2, SYSTEM_MESSAGE_TYPE.NORMAL_MESSAGE);
            return;
        }
        int num = (int)obj.Data;
        TICKET_SELL_INFO ticketSellInfo = this.GetTicketSellInfo(num);

        if (ticketSellInfo == null)
        {
            return;
        }
        string textFromInterface = NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("1699");

        string textFromMessageBox = NrTSingleton <NrTextMgr> .Instance.GetTextFromMessageBox("127");

        NrTSingleton <CTextParser> .Instance.ReplaceParam(ref textFromMessageBox, new object[]
        {
            textFromMessageBox,
            "count",
            ticketSellInfo.i32HeartsNum
        });

        MsgBoxUI msgBoxUI = NrTSingleton <FormsManager> .Instance.LoadForm(G_ID.MSGBOX_DLG) as MsgBoxUI;

        if (msgBoxUI != null)
        {
            msgBoxUI.SetMsg(new YesDelegate(this.MsgBoxOKTicketSellInfo), num, null, null, textFromInterface, textFromMessageBox, eMsgType.MB_OK_CANCEL);
        }
        this.m_fRequestTime    = Time.time;
        this.m_fScrollPosition = this.m_TicketList.ScrollPosition;
    }
Exemple #7
0
    public void SolTicketOpen()
    {
        if (this.m_OpenTicket == null)
        {
            return;
        }
        NkReadySolList readySolList = NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.GetReadySolList();

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

            Main_UI_SystemMessage.ADDMessage(textFromNotify, SYSTEM_MESSAGE_TYPE.NORMAL_MESSAGE);
            return;
        }
        if (this.m_OpenTicket.m_nItemNum >= 2 && this.GetNowOpenTicketCardType() == 0)
        {
            ItemBoxContinue_Dlg itemBoxContinue_Dlg = NrTSingleton <FormsManager> .Instance.LoadForm(G_ID.ITEM_BOX_CONTINUE_DLG) as ItemBoxContinue_Dlg;

            if (itemBoxContinue_Dlg == null)
            {
                return;
            }
            itemBoxContinue_Dlg.SetItemData(this.m_OpenTicket, ItemBoxContinue_Dlg.SHOW_TYPE.ITEM_TICKET);
            return;
        }
        else
        {
            ITEMINFO itemInfo = NrTSingleton <ItemManager> .Instance.GetItemInfo(this.m_OpenTicket.m_nItemUnique);

            if (itemInfo == null)
            {
                return;
            }
            NrTSingleton <NkClientLogic> .Instance.SetCanOpenTicket(false);

            if (itemInfo.IsItemATB(2048L) || itemInfo.IsItemATB(32768L))
            {
                this.SetRecruitButtonEnable(false);
                Protocol_Item.Item_Use(this.m_OpenTicket);
            }
            else
            {
                this.ExcuteTicket(this.m_OpenTicket.m_nItemUnique, itemInfo.m_nRecruitType, itemInfo.m_nParam[1], false);
            }
            return;
        }
    }
Exemple #8
0
    public override string GetConditionText(long i64ParamVal)
    {
        string textFromQuest_Code = NrTSingleton <NrTextMgr> .Instance.GetTextFromQuest_Code(this.m_szTextKey);

        string           empty          = string.Empty;
        NrPersonInfoUser charPersonInfo = NrTSingleton <NkCharManager> .Instance.GetCharPersonInfo(1);

        if (charPersonInfo == null)
        {
            return(string.Empty);
        }
        NkReadySolList readySolList = NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.GetReadySolList();

        if (readySolList == null)
        {
            return(string.Empty);
        }
        int num = 0;

        for (int i = 0; i < 6; i++)
        {
            NkSoldierInfo soldierInfo = charPersonInfo.GetSoldierList().GetSoldierInfo(i);
            if (soldierInfo != null)
            {
                if (soldierInfo.GetSolID() != 0L)
                {
                    if (!soldierInfo.IsLeader())
                    {
                        num++;
                    }
                }
            }
        }
        num += readySolList.GetCount();
        NrTSingleton <CTextParser> .Instance.ReplaceParam(ref empty, new object[]
        {
            textFromQuest_Code,
            "count1",
            num,
            "count2",
            base.GetParamVal()
        });

        return(empty);
    }
    public override void ExcuteGameGuide()
    {
        NrMyCharInfo myCharInfo = NrTSingleton <NkCharManager> .Instance.GetMyCharInfo();

        if (myCharInfo == null)
        {
            return;
        }
        NrPersonInfoUser charPersonInfo = NrTSingleton <NkCharManager> .Instance.GetCharPersonInfo(1);

        if (charPersonInfo == null)
        {
            return;
        }
        int num = -1;

        for (int i = 0; i < 6; i++)
        {
            NkSoldierInfo soldierInfo = charPersonInfo.GetSoldierInfo(i);
            if (soldierInfo != null)
            {
                if (soldierInfo.GetSolID() == 0L)
                {
                    if (myCharInfo.IsAddBattleSoldier(i))
                    {
                        num = i;
                        break;
                    }
                }
            }
        }
        if (num == -1)
        {
            return;
        }
        NkReadySolList readySolList = NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.GetReadySolList();

        if (readySolList == null)
        {
            return;
        }
        if (1 > readySolList.GetCount())
        {
            return;
        }
        List <NkSoldierInfo> list = new List <NkSoldierInfo>(readySolList.GetList().Values);

        if (list == null)
        {
            return;
        }
        list.Sort(new Comparison <NkSoldierInfo>(this.CompareExp));
        for (int j = 0; j < list.Count; j++)
        {
            NkSoldierInfo nkSoldierInfo = list[j];
            if (nkSoldierInfo != null)
            {
                NrCharKindInfo charKindInfo = nkSoldierInfo.GetCharKindInfo();
                if (charKindInfo != null)
                {
                    if (charKindInfo.GetCHARKIND_CLASSINFO() != null)
                    {
                        int num2 = 0;
                        for (int k = 0; k < 6; k++)
                        {
                            NkSoldierInfo soldierInfo2 = charPersonInfo.GetSoldierInfo(k);
                            if (soldierInfo2 != null)
                            {
                                if (soldierInfo2.GetSolID() != 0L)
                                {
                                    if (soldierInfo2.GetCharKind() == nkSoldierInfo.GetCharKind())
                                    {
                                        num2++;
                                    }
                                }
                            }
                        }
                        if (num2 < (int)nkSoldierInfo.GetJoinCount())
                        {
                            this.SendSolChangeToServer(ref nkSoldierInfo, 1, 1);
                            return;
                        }
                    }
                }
            }
        }
    }
    public override bool CheckGameGuideOnce()
    {
        NrMyCharInfo myCharInfo = NrTSingleton <NkCharManager> .Instance.GetMyCharInfo();

        if (myCharInfo == null)
        {
            return(false);
        }
        NrPersonInfoUser charPersonInfo = NrTSingleton <NkCharManager> .Instance.GetCharPersonInfo(1);

        if (charPersonInfo == null)
        {
            return(false);
        }
        bool flag = false;

        for (int i = 0; i < 6; i++)
        {
            NkSoldierInfo soldierInfo = charPersonInfo.GetSoldierInfo(i);
            if (soldierInfo != null)
            {
                if (soldierInfo.GetSolID() == 0L)
                {
                    if (myCharInfo.IsAddBattleSoldier(i))
                    {
                        flag = true;
                    }
                }
            }
        }
        if (!flag)
        {
            return(false);
        }
        NkReadySolList readySolList = NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.GetReadySolList();

        if (readySolList == null)
        {
            return(false);
        }
        if (1 > readySolList.GetCount())
        {
            return(false);
        }
        List <NkSoldierInfo> list = new List <NkSoldierInfo>(readySolList.GetList().Values);

        if (list == null)
        {
            return(false);
        }
        list.Sort(new Comparison <NkSoldierInfo>(this.CompareExp));
        for (int j = 0; j < list.Count; j++)
        {
            NkSoldierInfo nkSoldierInfo = list[j];
            if (nkSoldierInfo != null)
            {
                NrCharKindInfo charKindInfo = nkSoldierInfo.GetCharKindInfo();
                if (charKindInfo != null)
                {
                    if (charKindInfo.GetCHARKIND_CLASSINFO() != null)
                    {
                        if (nkSoldierInfo.GetSolPosType() != 2 && nkSoldierInfo.GetSolPosType() != 6)
                        {
                            int num = 0;
                            for (int k = 0; k < 6; k++)
                            {
                                NkSoldierInfo soldierInfo2 = charPersonInfo.GetSoldierInfo(k);
                                if (soldierInfo2 != null)
                                {
                                    if (soldierInfo2.GetSolID() != 0L)
                                    {
                                        if (soldierInfo2.GetCharKind() == nkSoldierInfo.GetCharKind())
                                        {
                                            num++;
                                        }
                                    }
                                }
                            }
                            if (num < (int)nkSoldierInfo.GetJoinCount())
                            {
                                this.m_kSolInfo = nkSoldierInfo;
                                return(true);
                            }
                        }
                    }
                }
            }
        }
        return(false);
    }
    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);
        }
    }