Beispiel #1
0
    public void Update(uint elapsed)
    {
        mLastMillionSec = (mLastMillionSec + elapsed) % uint.MaxValue;

        if ((mLastMillionSec - mOneSecNum) >= 1000)
        {
            mOneSecNum = mLastMillionSec;

            PlayerShopData data = Module.GetPlayerShopData();
            if (data == null)
            {
                GameDebug.LogError("商店数据错误!");
                return;
            }

            if (data.Seconds < 0)
            {
                return;
            }

            if (data.Seconds == 0)
            {
                ShopFreeRefreshAction param = new ShopFreeRefreshAction();
                param.OpType = (int)ShopOpType.FreeRefresh;

                Net.Instance.DoAction((int)Message.MESSAGE_ID.ID_MSG_SHOP, param);
            }

            data.Seconds--;

            //Debug.Log(data.Seconds);
        }
    }
Beispiel #2
0
    protected override void OnRequest(request_shop_op request, object userdata)
    {
        if (userdata is ShopBuyItemAction)
        {
            ShopBuyItemAction param = userdata as ShopBuyItemAction;
            request.op_type = param.OpType;
            request.shopid  = param.ResId;
        }

        if (userdata is ShopRefreshAction)
        {
            ShopRefreshAction param = userdata as ShopRefreshAction;
            request.op_type = param.OpType;
        }

        if (userdata is ShopFreeRefreshAction)
        {
            ShopFreeRefreshAction param = userdata as ShopFreeRefreshAction;
            request.op_type = param.OpType;
        }
    }