コード例 #1
0
    private void On_Button(IUIObject obj)
    {
        List <Protocol_Item.Add_Item> list = new List <Protocol_Item.Add_Item>();

        Protocol_Item.Add_Item item = default(Protocol_Item.Add_Item);
        ITEMINFO itemInfo           = NrTSingleton <ItemManager> .Instance.GetItemInfo(this.m_cItem.m_nItemUnique);

        ITEM_BOX_GROUP iTEM_BOX_GROUP = null;

        if (itemInfo.IsItemATB(65536L))
        {
            iTEM_BOX_GROUP = NrTSingleton <ItemManager> .Instance.GetBoxGroup(this.m_cItem.m_nItemUnique);

            if (iTEM_BOX_GROUP == null)
            {
                return;
            }
        }
        if (itemInfo != null)
        {
            for (int i = 0; i < 12; i++)
            {
                int num;
                int num2;
                if (iTEM_BOX_GROUP != null)
                {
                    num  = iTEM_BOX_GROUP.i32GroupItemUnique[i];
                    num2 = iTEM_BOX_GROUP.i32GroupItemNum[i];
                }
                else
                {
                    num  = itemInfo.m_nBoxItemUnique[i];
                    num2 = itemInfo.m_nBoxItemNumber[i];
                }
                if (num > 0)
                {
                    if (!Protocol_Item.CanAddItem(num, num2))
                    {
                        string textFromNotify = NrTSingleton <NrTextMgr> .Instance.GetTextFromNotify("46");

                        Main_UI_SystemMessage.ADDMessage(textFromNotify, SYSTEM_MESSAGE_TYPE.NAGATIVE_MESSAGE);
                        return;
                    }
                    item.m_nItemUnique = num;
                    item.m_nItemNum    = num2;
                    list.Add(item);
                }
            }
        }
        if (this.m_eItemMall_BoxType == eITEMMALL_BOXTRADE_TYPE.ITEMMALL_TRADETYPE_GETBOX)
        {
            GS_BOX_USE_REQ gS_BOX_USE_REQ = new GS_BOX_USE_REQ();
            gS_BOX_USE_REQ.m_nItemID     = this.m_cItem.m_nItemID;
            gS_BOX_USE_REQ.m_nItemUnique = this.m_cItem.m_nItemUnique;
            gS_BOX_USE_REQ.m_nPosType    = this.m_cItem.m_nPosType;
            gS_BOX_USE_REQ.m_nItemPos    = this.m_cItem.m_nItemPos;
            SendPacket.GetInstance().SendObject(eGAME_PACKET_ID.GS_BOX_USE_REQ, gS_BOX_USE_REQ);
        }
        this.Close();
    }
コード例 #2
0
    public static void On_Sead_Box_Use_Random(object a_oObject)
    {
        ITEM iTEM = a_oObject as ITEM;

        if (iTEM != null)
        {
            GS_BOX_USE_REQ gS_BOX_USE_REQ = new GS_BOX_USE_REQ();
            gS_BOX_USE_REQ.m_nItemID     = iTEM.m_nItemID;
            gS_BOX_USE_REQ.m_nItemUnique = iTEM.m_nItemUnique;
            gS_BOX_USE_REQ.m_nPosType    = iTEM.m_nPosType;
            gS_BOX_USE_REQ.m_nItemPos    = iTEM.m_nItemPos;
            gS_BOX_USE_REQ.m_nArrayIndex = 0;
            SendPacket.GetInstance().SendObject(eGAME_PACKET_ID.GS_BOX_USE_REQ, gS_BOX_USE_REQ);
        }
    }
コード例 #3
0
    public void Request_OpenBox(object param)
    {
        if (this.m_cItem == null)
        {
            Debug.LogError("ERROR, Item_Box_Select_Dlg.cs, BoxOpen(), m_cItem Is Null");
            return;
        }
        int            nArrayIndex    = (int)param;
        GS_BOX_USE_REQ gS_BOX_USE_REQ = new GS_BOX_USE_REQ();

        gS_BOX_USE_REQ.m_nItemID     = this.m_cItem.m_nItemID;
        gS_BOX_USE_REQ.m_nItemUnique = this.m_cItem.m_nItemUnique;
        gS_BOX_USE_REQ.m_nPosType    = this.m_cItem.m_nPosType;
        gS_BOX_USE_REQ.m_nItemPos    = this.m_cItem.m_nItemPos;
        gS_BOX_USE_REQ.m_nArrayIndex = nArrayIndex;
        gS_BOX_USE_REQ.m_nItemCount  = this.m_nCurItemNum;
        gS_BOX_USE_REQ.m_byAllOpen   = 1;
        SendPacket.GetInstance().SendObject(eGAME_PACKET_ID.GS_BOX_USE_REQ, gS_BOX_USE_REQ);
        base.CloseNow();
    }
コード例 #4
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);
        }
    }