Exemplo n.º 1
0
    protected override void OnRespond(respond_mall_buy respond, object userdata)
    {
        MallFormModule module = ModuleManager.Instance.FindModule <MallFormModule>();

        if (module == null)
        {
            GameDebug.LogError("没有找到mallmodule");
            return;
        }

        if (respond.result != (int)Message.ERROR_CODE.ERR_MALL_OK)
        {
            switch ((Message.ERROR_CODE)respond.result)
            {
            case ERROR_CODE.ERR_MALL_BUY_NO_MONEY:
                break;

            case ERROR_CODE.ERR_MALL_BUY_NO_TIMES:
                break;

            case ERROR_CODE.ERR_MALL_FAILED:
                break;

            default:
                break;
            }
            return;
        }

        if (userdata is MallBuyItemAction)
        {
            module.BuyMallItem(respond.mallid, respond.subid);
        }
    }
Exemplo n.º 2
0
    public int GetTimesByMallId(int mallId)
    {
        MallFormModule mallmodule = ModuleManager.Instance.FindModule <MallFormModule>();

        if (mallmodule == null)
        {
            return(0);
        }

        MallLimitType type = mallmodule.GetLimitTypeByID(mallId);

        switch (type)
        {
        case MallLimitType.ERROR:
            return(-1);

        case MallLimitType.NONE:
            return(-1);

        case MallLimitType.DAY:
            if (mDayCount.ContainsKey(mallId))
            {
                return(mDayCount[mallId]);
            }
            return(0);

        case MallLimitType.FOREVER:
            int itemId = mallmodule.GetItemIdByMallId(mallId);
            if (ItemManager.GetItemRes(itemId) == null)
            {
                GameDebug.LogError("商城中对应的物品在物品表中不存在");
                return(-1);
            }

            if (mForeverCount.ContainsKey(itemId))
            {
                return(mForeverCount[itemId]);
            }
            return(0);
        }
        return(-1);
    }
Exemplo n.º 3
0
    public bool RequestForge()
    {
        WingItemData wing_item_data;

        GetWingItemData(mCurPageNum, out wing_item_data);
        WingCommonTableItem wing_common_res = DataManager.WingCommonTable[wing_item_data.id] as WingCommonTableItem;
        PlayerDataModule    pdm             = ModuleManager.Instance.FindModule <PlayerDataModule>();

        uint curCostNum = pdm.GetItemNumByID(wing_common_res.costId);

        if (curCostNum == 0)
        {
            MallFormModule mallModule = ModuleManager.Instance.FindModule <MallFormModule>();
            mallModule.OpenMallFormByItemId(wing_common_res.costId, "wing");
            return(false);
        }
        if (wing_item_data.level == (wing_common_res.middleLevel - 1) || wing_item_data.level == (wing_common_res.hightLevel - 1))
        {
            IsReEquip = true;
        }
        Net.Instance.DoAction((int)MESSAGE_ID.ID_MSG_WING_FORGE, wing_item_data.id);
        return(true);
    }