Ejemplo n.º 1
0
    public void TryReceiveReward(ECopyType copyType, int chapter, int awardIndex)
    {
        if (awardIndex < 0 || awardIndex > 2)
        {
            GTItemHelper.ShowTip("非法AwardIndex" + awardIndex);
            return;
        }
        int rewardState = RaidModule.Instance.GetChapterRewardStateByAwardIndex(chapter, awardIndex);

        switch (rewardState)
        {
        case ERewardState.NOT_RECEIVE:
            GTItemHelper.ShowTip("未达成条件");
            return;

        case ERewardState.HAS_RECEIVE:
            GTItemHelper.ShowTip("奖励已领取");
            return;
        }
        DWorld chapterDB = ReadCfgWorld.GetDataById(chapter);
        DAward awardDB   = ReadCfgAward.GetDataById(chapterDB.Awards[awardIndex]);

        if (GTItemHelper.CheckBagFull(awardDB.MaxDropNum))
        {
            return;
        }

        ReqGetChapterAward req = new ReqGetChapterAward();

        req.CopyType = (int)copyType;
        req.Chapter  = chapter;
        req.Index    = awardIndex;
        NetworkManager.Instance.Send <ReqGetChapterAward>(MessageID.MSG_REQ_GET_CHAPTERAWARD, req);
    }
Ejemplo n.º 2
0
    public void TryUnloadEquip(int tarPos)
    {
        if (GTItemHelper.CheckBagFull(1, EBagType.ITEM))
        {
            return;
        }
        ReqUnloadEquip req = new ReqUnloadEquip();

        req.TarPos = tarPos;
        NetworkManager.Instance.Send <ReqUnloadEquip>(MessageID.MSG_REQ_UNLOAD_EQUIP, req);
    }
Ejemplo n.º 3
0
    public void TryUnloadGem(int index, int tarPos)
    {
        if (GTItemHelper.CheckBagFull(1, EBagType.GEM))
        {
            return;
        }

        ReqUnloadGem req = new ReqUnloadGem();

        req.TarPos = tarPos;
        req.Index  = index;
        NetworkManager.Instance.Send <ReqUnloadGem>(MessageID.MSG_REQ_UNLOAD_GEM, req);
    }
Ejemplo n.º 4
0
    public void TryComposeChip(int srcPos)
    {
        XItem item       = DataDBSBagChip.Dict[srcPos];
        DItem itemDB     = ReadCfgItem.GetDataById(item.Id);
        int   composeNum = item.Num / itemDB.Data1;

        if (GTItemHelper.CheckBagFull(composeNum, EBagType.GEM))
        {
            return;
        }
        ReqComposeChip req = new ReqComposeChip();

        req.SrcPos = srcPos;
        req.Num    = composeNum;
        NetworkManager.Instance.Send <ReqComposeChip>(MessageID.MSG_REQ_COMPOSE_CHIP, req);
    }
Ejemplo n.º 5
0
    public void TryMainCopyReceiveReward(int chapter, int index)
    {
        ERewardState rewardState = MLRaid.Instance.GetChapterRewardStateByAwardIndex(chapter, index);

        switch (rewardState)
        {
        case ERewardState.NOT_RECEIVE:
            GTItemHelper.ShowTip("未达成条件");
            return;

        case ERewardState.HAS_RECEIVE:
            GTItemHelper.ShowTip("奖励已领取");
            return;
        }
        DCopyMainChapter chapterDB = ReadCfgCopyMainChapter.GetDataById(chapter);
        DAward           awardDB   = ReadCfgAward.GetDataById(chapterDB.Awards[index]);

        if (GTItemHelper.CheckBagFull(awardDB.MaxDropNum))
        {
            return;
        }
    }
Ejemplo n.º 6
0
    public void TryBuyStore(int storeType, int storeID, int num)
    {
        DStore storeDB = ReadCfgStore.GetDataById(storeID);

        if (storeDB == null)
        {
            GTItemHelper.ShowTip("非法物品");
            return;
        }
        if (GTItemHelper.CheckItemEnongh(storeDB.CostMoneyID, storeDB.CostMoneyNum) == false)
        {
            return;
        }
        if (GTItemHelper.CheckBagFull(1))
        {
            return;
        }
        ReqBuyStore req = new ReqBuyStore();

        req.StoreType = storeType;
        req.StoreID   = storeID;
        req.Num       = num;
        NetworkManager.Instance.Send <ReqBuyStore>(MessageID.MSG_REQ_BUY_STORE, req);
    }
Ejemplo n.º 7
0
    public void TryUseItemByPos(int pos, int num)
    {
        XItem item = DataDBSBagItem.GetDataById(pos);

        if (item.Num < num)
        {
            GTItemHelper.ShowTip("物品不足");
            return;
        }
        DItem itemDB = ReadCfgItem.GetDataById(item.Id);

        if (itemDB.ItemType == EItemType.BOX)
        {
            if (itemDB.Data1 != 0)
            {
                if (GTDataManager.Instance.GetItemCountById(itemDB.Data1) < num)
                {
                    GTItemHelper.ShowTip("需要足够的钥匙");
                    return;
                }
            }
            DAward awardDB = ReadCfgAward.GetDataById(itemDB.Data2);
            if (GTItemHelper.CheckBagFull(awardDB.MaxDropNum))
            {
                return;
            }
        }

        ReqUseItem req = new ReqUseItem();

        req.Pos     = pos;
        req.Num     = num;
        req.PosType = (int)EPosType.BagItem;
        req.ID      = item.Id;
        NetworkManager.Instance.Send <ReqUseItem>(MessageID.MSG_REQ_USEITEM, req);
    }