private void SetAwardProperty() { ArkCrossEngine.RoleInfo player = ArkCrossEngine.LobbyClient.Instance.CurrentRole; if (player != null) { if (myscorelabel != null) {//积分 myscorelabel.text = player.Gow.GowElo.ToString(); } if (myRanklabel != null) {//排名 myRanklabel.text = GetRankTxt(player); } GowPrizeConfig config = GowConfigProvider.Instance.FindGowPrizeConfig(player.Gow.RankId); if (config != null) { if (lblAwardDiamond != null) { lblAwardDiamond.text = config.Gold.ToString(); } if (lblAwardMoney != null) { lblAwardMoney.text = config.Money.ToString(); } } } }
internal void HandleRequestGowPrize(ulong guid) { DataProcessScheduler scheduler = LobbyServer.Instance.DataProcessScheduler; UserInfo user = scheduler.GetUserInfo(guid); if (null == user || null == user.GowInfo) { return; } GowPrizeConfig cfg = GowConfigProvider.Instance.FindGowPrizeConfig(user.GowInfo.RankId); if (null != cfg) { ProvideGowPrize(guid, cfg); } }
private void ProvideGowPrize(ulong guid, GowPrizeConfig cfg) { DataProcessScheduler scheduler = LobbyServer.Instance.DataProcessScheduler; UserInfo user = scheduler.GetUserInfo(guid); if (null == user) { return; } JsonMessageWithGuid pgpMsg = new JsonMessageWithGuid(JsonMessageID.RequestGowPrize); pgpMsg.m_Guid = guid; ArkCrossEngineMessage.Msg_LC_RequestGowPrizeResult protoData = new ArkCrossEngineMessage.Msg_LC_RequestGowPrizeResult(); if (user.GowInfo.IsAcquirePrize) { protoData.m_Result = (int)GeneralOperationResult.LC_Failure_Unknown; } else { int money_incr = cfg.Money; int gold_incr = cfg.Gold; protoData.m_Money = money_incr; protoData.m_Gold = gold_incr; scheduler.DispatchAction(scheduler.DoAddAssets, guid, money_incr, gold_incr, 0, 0, GainConsumePos.Gow.ToString()); if (null != cfg.Items && cfg.Items.Count > 0) { for (int i = 0; i < cfg.Items.Count; ++i) { GowPrizeItem item = cfg.Items[i]; if (null != item) { scheduler.DispatchAction(scheduler.DoAddItem, guid, item.ItemId, item.ItemNum, GainConsumePos.Gow.ToString()); ArkCrossEngineMessage.Msg_LC_RequestGowPrizeResult.AwardItemInfo itemDataMsg = new ArkCrossEngineMessage.Msg_LC_RequestGowPrizeResult.AwardItemInfo(); itemDataMsg.m_Id = item.ItemId; itemDataMsg.m_Num = item.ItemNum; protoData.m_Items.Add(itemDataMsg); } } } protoData.m_Result = (int)GeneralOperationResult.LC_Succeed; user.GowInfo.IsAcquirePrize = true; } pgpMsg.m_ProtoData = protoData; JsonMessageDispatcher.SendDcoreMessage(user.NodeName, pgpMsg); }
public MailInfo GetMail(ModuleMailInfo moduleMailInfo, UserInfo user, bool onlyAttachment) { MailInfo mailInfo = null; mailInfo = moduleMailInfo.NewDerivedMailInfo(); if (!onlyAttachment) { mailInfo.m_Title = "$1$"; mailInfo.m_Text = "$2$"; mailInfo.m_Sender = "$3$"; } int gowElo = 0; DateTime sendDate = mailInfo.m_SendTime.Date; DateTime sendTime = new DateTime(sendDate.Year, sendDate.Month, sendDate.Day, m_PrizeTime.m_Hour, m_PrizeTime.m_Minute, m_PrizeTime.m_Second); long key = sendTime.ToBinary(); SortedList <long, int> history = user.GowInfo.HistoryGowElos; foreach (long key0 in history.Keys) { if (key >= key0) { gowElo = history[key0]; break; } } if (gowElo > 0) { GowPrizeConfig cfg = GowConfigProvider.Instance.FindGowPrizeConfig(user.GowInfo.RankId); if (null != cfg) { mailInfo.m_Money = cfg.Money; mailInfo.m_Gold = cfg.Gold; foreach (GowPrizeItem item_config in cfg.Items) { MailItem mail_item = new MailItem(); mail_item.m_ItemId = item_config.ItemId; mail_item.m_ItemNum = item_config.ItemNum; mailInfo.m_Items.Add(mail_item); } return(mailInfo); } } return(null); }