コード例 #1
0
        public void RequestClaimQuickIdleReward(ClaimRewardCallback callback)
        {
            if (!isStart)
            {
                callback?.Invoke(GoodsRequestResult.NetFail, 0);
                return;
            }
            int costDiamond;

            if (!GetQuickIdleCost(out costDiamond))
            {
                callback?.Invoke(GoodsRequestResult.Undefine, 0);
                return;
            }
            var rewardGold = GetQuickIdleRewardGold();

            if (rewardGold <= 0)
            {
                callback?.Invoke(GoodsRequestResult.Success, 0);
                return;
            }

            extraActOnServerFixed += (fixSuccess) =>
            {
                if (fixSuccess)
                {
                    GameGoodsMgr.singleton.RequestCostAddGameGoods((GoodsRequestResult result, List <GameGoodData> realAddGoods, HashSet <string> tips, string failDetail) =>
                    {
                        if (result == GoodsRequestResult.Success)
                        {
                            Debug.Log("Idle quick reward gold:" + rewardGold.ToSymbolString());
                            quickIdleIndex++;
                            UpdateRecord();

                            CampTaskMgr.singleton.AddTaskData(TaskType.Quick_Reward, 1);
                        }
                        callback?.Invoke(result, rewardGold);
                    },
                                                                   (int)GoodsType.DIAMOND, costDiamond, -1,
                                                                   (int)GoodsType.GOLD, rewardGold, -1);
                }
                else
                {
                    callback?.Invoke(GoodsRequestResult.NetFail, 0);
                }
            };
            DateTimeMgr.singleton.FixedLocalTime();
        }
コード例 #2
0
 public void RequestClaimOfflineReward(ClaimRewardCallback callback)
 {
     fixedServerTimeCallback += (success) =>
     {
         if (success)
         {
             AddOfflineReward();
             callback?.Invoke(CampsiteRequestResult.Success);
         }
         else
         {
             callback?.Invoke(CampsiteRequestResult.NetFail);
         }
     };
     DateTimeMgr.singleton.FixedLocalTime();
 }
コード例 #3
0
        public void RequestClaimIdleReward(ClaimRewardCallback callback)
        {
            if (!isStart)
            {
                callback?.Invoke(GoodsRequestResult.Undefine, 0);
                return;
            }

            extraActOnServerFixed += (fixSuccess) =>
            {
                if (fixSuccess)
                {
                    var rewardGold = GetRewardGold();
                    if (rewardGold <= 0)
                    {
                        callback?.Invoke(GoodsRequestResult.Success, 0);
                    }

                    GameGoodsMgr.singleton.RequestAddGameGoods((GoodsRequestResult result, List <GameGoodData> realAddGoods, HashSet <string> tips) =>
                    {
                        if (result == GoodsRequestResult.Success)
                        {
                            Debug.Log("Idle reward gold:" + rewardGold.ToSymbolString());
                            if ((DateTimeMgr.singleton.UtcNow - settlementTime).TotalSeconds > 61f)
                            {
                                settlementTime = DateTimeMgr.singleton.UtcNow;
                            }
                            startTime = settlementTime;
                            settlementList.Clear();
                            UpdateRecord();
                            EZ.Global.gApp.gMsgDispatcher.Broadcast(EZ.MsgIds.IdleRewardClaim);

                            CampTaskMgr.singleton.AddTaskData(TaskType.Explore_Gold, 1);
                        }
                        callback?.Invoke(result, rewardGold);
                    },
                                                               (int)GoodsType.GOLD, rewardGold);
                }
                else
                {
                    callback?.Invoke(GoodsRequestResult.NetFail, 0);
                }
            };
            DateTimeMgr.singleton.FixedLocalTime();
        }