private void GameHandler_DailyCheckRequest(IResponer responer, PktDailyCheckRequest vo) { var player = APlayerManager.Instance.OnGetPlayerByConn(responer.playerConnDesc); if (player == null) { return; } var pinfo = new CakeAvatar(player.psid); if (ApiDateTime.IsSameDay(pinfo.GetIntValue(ParamNameDefs.LastDailyCheckTime))) { return; } var count = pinfo.GetIntValue(ParamNameDefs.DailyCheckCount); var data = DailyCheckLoader.Instance.OnGetData(count + 1); if (data == null) { count = 1; data = DailyCheckLoader.Instance.OnGetData(count); } SCommonds.AddItem("dailycheck", player.psid, data.itemID, data.itemCount); pinfo.SetValue(ParamNameDefs.LastDailyCheckTime, ApiDateTime.SecondsFromBegin()); var pkt = new PktDailyCheckResult(); pkt.eResult = PktDailyCheckResult.EResult.Success; pkt.lItems.Add(new Int2() { int1 = data.itemID, int2 = data.itemCount }); responer.Response(pkt); }
internal HttpResponseMessage OnDailyCheck() { if (ApiDateTime.IsSameDay(LastDailyCheckTime)) { return(ResultToJson.GetErrorJsonResponse(ErrorDefs.DailyChecked)); } LastDailyCheckTime = ApiDateTime.SecondsFromBegin(); AvatarGold += 1000; return(GetDiryParamResponse()); }
public static void DailyCheck(string psid) { var cake = new CakeAvatar(psid); if (ApiDateTime.IsSameDay(cake.GetIntValue(ParamNameDefs.LastDailyCheckTime))) { return; } var icount = cake.AddValue(ParamNameDefs.DailyCheckCount); var data = DailyCheckLoader.Instance.OnGetData(icount); if (data == null) { icount = 1; cake.SetValue(ParamNameDefs.DailyCheckCount, icount); data = DailyCheckLoader.Instance.OnGetData(icount); } }
private void OnParamUpdateCb(UEventBase eb) { textGold.text = CakeClient.GetCake("items", CakeAvatar.myID, LibCommon.InitValueDefs.gold.ToString()).GetIntValue(ParamNameDefs.Count).ToString(); textDiamond.text = CakeClient.GetCake("items", CakeAvatar.myID, LibCommon.InitValueDefs.money.ToString()).GetIntValue(ParamNameDefs.Count).ToString(); btnDailyCheck.gameObject.SetActive(!ApiDateTime.IsSameDay(CakeClient.GetCake("pinfo", CakeAvatar.myID).GetIntValue(ParamNameDefs.LastDailyCheckTime))); }