private void GetGift(GiftItem item) { uint idx = (uint)item.resData.id; m_myself.RpcCall("DrawGift", idx); TimerHeap.AddTimer(100, 0, GiftRecordReq); }
private void UpdateTime() { KPve pveInfo = KConfigFileManager.GetInstance().pveList.getData(pveID.ToString()); if (pveInfo == null) { return; } int nCompleteTime = completeTime + (int)PlayerManager.GetInstance().MajorPlayer.onlineTime - enterTime; ProcessTime.text = GiftItem.FormatTime(nCompleteTime); ExitTime.text = "副本退出时间:<40b9ff>" + GiftItem.FormatTime(exsistTime - nCompleteTime) + "<->"; Process1.gameObject.SetActive(false); Process2.gameObject.SetActive(false); Process3.gameObject.SetActive(false); if (nCompleteTime > pveInfo.tNormalTime) { Process3.gameObject.SetActive(true); } else if (nCompleteTime > pveInfo.tGoodTime) { Process2.gameObject.SetActive(true); } else { Process1.gameObject.SetActive(true); } }
public void CreateGiftList(GiftItemData[] rawData) { Debug.Log("Create GiftList"); ClearAllList(); giftList = rawData; //create gift int i = 0; foreach (GiftItemData item in giftList) { GameObject obj = (GameObject)GameObject.Instantiate(giftPrefabs); obj.transform.parent = this.transform; GiftItem gf = obj.GetComponent <GiftItem>(); gf.acceptGift.box = list.touchArea; gf.SetGiftItem(i, GiftHeight, item); gf.postAccept += postAcceptGift; i++; } BG.setHeight(GiftHeight * i); if (i > 0) { BG.gameObject.SetActive(true); NothingText.SetActive(false); } else { NothingText.SetActive(true); } list.ListHeight = GiftHeight * i; }
public void InitPveMap(int nPveID, int nCompleteTime, RemoteTable pveValue) { KPve pveInfo = KConfigFileManager.GetInstance().pveList.getData(nPveID.ToString()); showText = pveInfo.Text; enterTime = (int)PlayerManager.GetInstance().MajorPlayer.onlineTime; MapName.text = pveInfo.Name; ProcessTime.text = GiftItem.FormatTime(nCompleteTime); completeTime = nCompleteTime; exsistTime = pveInfo.tExistTime; pveID = nPveID; UpdateTime(); for (int i = 0; i < 9; i++) { int nValue = pveValue[i]; mapValue[i] = nValue; } UpdateValue(); ShowProcess(); }
public object ShowPveView(int nPveID, float fCompleteTime, RemoteTable award) { KPve pveInfo = KConfigFileManager.GetInstance().pveList.getData(nPveID.ToString()); Open(null); SuccSprite1.gameObject.SetActive(false); SuccSprite2.gameObject.SetActive(false); SuccSprite3.gameObject.SetActive(false); if (fCompleteTime > pveInfo.tNormalTime) { SuccSprite1.gameObject.SetActive(true); nShowStar = 1; } else if (fCompleteTime > pveInfo.tGoodTime) { SuccSprite2.gameObject.SetActive(true); Star3.gameObject.SetActive(false); nShowStar = 2; } else { SuccSprite3.gameObject.SetActive(true); nShowStar = 3; } CompleteTimeLabel.text = GiftItem.FormatTime((int)fCompleteTime); ShowAward(award); showTime = (int)PlayerManager.GetInstance().MajorPlayer.onlineTime; return(null); }
void FixedUpdate() { if (curCountingGiftItem == null && this.isCounting) { curCountingGiftItem = this; ActiveRedio(CountTimeBtn); } if (curCountingGiftItem == this && this.isCounting) { MajorPlayer player = PlayerManager.GetInstance().MajorPlayer; int timeCount = GiftData.nOnlineTime * 60 - (int)player.onlineTime; if (timeCount > 0) { CountTimeLabel.text = FormatTime(timeCount); } else { this.isCounting = false; curCountingGiftItem = null; ActiveRedio(UnGainBtn); } } if (resize) { //float x = TimeLabel.width + TimeLabel.transform.localPosition.x + (GoodsList.cellWidth * GoodsList.transform.childCount / 2) + 10; //Vector3 v = GoodsList.transform.localPosition; //GoodsList.transform.localPosition = new Vector3(x, v.y, v.z); resize = false; } }
protected override void Init() { base.Init(); base.Hide(); Dictionary <string, KGiftData> giftAllData = KConfigFileManager.GetInstance().giftTabFile.getAllData(); List <KGiftData> levelAndCombatGiftDataList = new List <KGiftData>(); foreach (KGiftData giftData in giftAllData.Values) { if (giftData.eType == KGiftType.gtLevel || giftData.eType == KGiftType.gtCombat) { levelAndCombatGiftDataList.Add(giftData); } } levelAndCombatGiftDataList.Sort( delegate(KGiftData k1, KGiftData k2) { int compare = k1.nCombatLimit - k2.nCombatLimit; if (compare == 0) { return(k1.nLevelLimit - k2.nLevelLimit); } else { return(compare); } } ); foreach (KGiftData giftData in levelAndCombatGiftDataList) { UIDragPanelContents uiDragPanelContents = (UIDragPanelContents)UnityEngine.Object.Instantiate(base.GiftItem, base.GiftItem.transform.position, base.GiftItem.transform.rotation); uiDragPanelContents.transform.localScale = base.GiftItem.transform.lossyScale; GiftItem giftItem = uiDragPanelContents.gameObject.AddComponent <GiftItem>(); giftItem.Init(giftData); if (giftData.eType == KGiftType.gtLevel) { uiDragPanelContents.transform.parent = base.LevelList.gameObject.transform; LevelGiftItemList.Add(giftItem); } else if (giftData.eType == KGiftType.gtCombat) { uiDragPanelContents.transform.parent = base.CombatList.gameObject.transform; CombatGiftItemList.Add(giftItem); } } base.GiftItem.gameObject.SetActive(false); base.LevelList.sorted = false; base.LevelList.repositionNow = true; base.CombatList.sorted = false; base.CombatList.repositionNow = true; this.isListChanged = true; }
/// <summary> /// Add a gift to the list for a specific giftee. /// </summary> /// <param name="gift">A gift.</param> /// <param name="owner">The giftee.</param> public void Post(GiftItem gift, string owner) { if (!string.IsNullOrWhiteSpace(gift?.Title)) { GiftBag.Add(new GiftItem { Title = gift.Title, Owner = owner }); } }
// Initializes a gift by setting component references and displaying its sprite. public void Init(GiftItem gift, Sprite giftSprite) { this.giftInfo = gift; giftImage = GetComponentInChildren <Image>(); //TEMP, Grabs generic image. giftSprite = giftImage.sprite; setSlot(this.giftInfo, giftSprite); }
public object UpdateGiftItem(params object[] objs) { if (this == curCountingGiftItem) { curCountingGiftItem = null; } UpdateUIOnDataChanged(); EventDispatcher.GameWorld.Remove(ControllerCommand.GIFT_ITEM_UPDATE, UpdateGiftItem); return(null); }
public void AddNewGIft(GiftItem giftAdded) { var sql = @"INSERT INTO [dbo].[Gift] ([Recepient] ,[Item] ,[Price] ,[BudgetId]) VALUES (@recepient, @item, @price, @budgetId)"; using var db = new SqlConnection(_connectionString); var newId = db.ExecuteScalar <int>(sql, giftAdded); giftAdded.id = newId; }
static void Main(string[] args) { //Console.WriteLine("Hello World!"); var queryforProduct = new Laptop(); var computerShop = new Shop(); var responsibleforCalculation = new CalculateComputerPrice(); var myAnswer = computerShop.GetMyComputerPrice(responsibleforCalculation, queryforProduct); var myAnswer1 = computerShop.GetAvailableColor(queryforProduct); //Gift var queryforProduct1 = new GiftItem(); var computerShop1 = new Shop(); var myAnswer2 = computerShop1.IsThereAnyGiftItem(queryforProduct1); Console.WriteLine(myAnswer); Console.WriteLine(myAnswer1); Console.WriteLine(myAnswer2); Console.ReadKey(); }
private double CreateGift(double topMargin) { if (this._giftAttachment == null) { return(0.0); } topMargin += 8.0; if (this._giftItem == null) { this._giftItem = new GiftItem(this._verticalWidth, new Thickness(0.0, topMargin, 0.0, 0.0), this._giftAttachment, this._horizontalWidth, this._isHorizontal); this.VirtualizableChildren.Add((IVirtualizable)this._giftItem); } else { this._giftItem.IsHorizontal = this._isHorizontal; this._giftItem.Margin = new Thickness(0.0, topMargin, 0.0, 0.0); } return(this._giftItem.FixedHeight); }
private void BuildGifts() { gifts.Clear(); int vocation = (int)MogoWorld.thePlayer.vocation; foreach (var item in LevelGiftData.dataMap) { if (gotGifts.Contains(item.Key)) { continue; } if (item.Value.vocation != vocation && item.Value.vocation != 0) { continue; } GiftItem m = new GiftItem(item.Value); gifts.Add(m); } }
protected override void Init() { base.Init(); base.Hide(); Dictionary <string, KGiftData> GiftAllData = KConfigFileManager.GetInstance().giftTabFile.getAllData(); List <KGiftData> onlineGiftDataList = new List <KGiftData>(); foreach (KGiftData giftData in GiftAllData.Values) { if (giftData.eType == KGiftType.gtOnlineTime) { onlineGiftDataList.Add(giftData); } } onlineGiftDataList.Sort( delegate(KGiftData k1, KGiftData k2) { return(k1.nOnlineTime - k2.nOnlineTime); } ); foreach (KGiftData onlineGiftData in onlineGiftDataList) { UIDragPanelContents uiDragPanelContents = (UIDragPanelContents)UnityEngine.Object.Instantiate(base.GiftItem, base.GiftItem.transform.position, base.GiftItem.transform.rotation); uiDragPanelContents.transform.localScale = base.GiftItem.transform.lossyScale; uiDragPanelContents.transform.parent = base.GiftList.gameObject.transform; GiftItem giftItem = uiDragPanelContents.gameObject.AddComponent <GiftItem>(); giftItem.Init(onlineGiftData); OnlineGiftItemList.Add(giftItem); } base.GiftItem.gameObject.SetActive(false); base.GiftList.sorted = false; base.GiftList.repositionNow = true; }
private void UpdateGiftList(UITable uiTable, List <GiftItem> giftItemList, int curListIndex) { int maxListIndex = Mathf.CeilToInt((float)giftItemList.Count / LIST_ITEM_MAX_SIZE); isBackBtnAbled = true; isForwardBtnAbled = true; if (curListIndex == 1) { isBackBtnAbled = false; } if (curListIndex == maxListIndex) { isForwardBtnAbled = false; } string toolerLabelText = curListIndex + "/" + maxListIndex; base.ToolerLabel.text = toolerLabelText; foreach (GiftItem giftItem in giftItemList) { Disable(giftItem); } int beginIndex = (curListIndex - 1) * LIST_ITEM_MAX_SIZE; int endIndex = beginIndex + LIST_ITEM_MAX_SIZE; endIndex = endIndex < giftItemList.Count ? endIndex : giftItemList.Count; for (; beginIndex < endIndex; ++beginIndex) { GiftItem giftItem = giftItemList[beginIndex]; Active(giftItem); } uiTable.repositionNow = true; }
public void UserLogin(PlayerLoginEvent loginevent) { new Thread((ThreadStart)(() => { User user = loginevent.Player.User; Thread.Sleep(20000); CheckPlayer(user); using (var db = new LiteDatabase(@"GBSpender.db")) { SpenderUser existUser; var spenderUsers = db.GetCollection <SpenderUser>("SpenderUser"); if (user.SteamId != null) { existUser = spenderUsers.FindOne(x => x.SteamId.Contains(user.SteamId)); } else { existUser = spenderUsers.FindOne(x => x.SteamId.Contains(user.SlgId)); } if (existUser != null && (existUser.EndDate.Subtract(DateTime.Now).Days >= 0 || existUser.Patreon == true)) { User savedUser; if (user.SteamId != null) { savedUser = UserManager.FindUserBySteamId(existUser.SteamId); } else { savedUser = UserManager.FindUserBySlgId(existUser.SlgId); } ChatManager.ServerMessageToPlayer(new LocString("Willkommen Spender!"), savedUser, false, DefaultChatTags.Notifications, ChatCategory.Info); ChatManager.ServerMessageToPlayer(new LocString("Deine Spender Mitgliedschaft ist noch bis zum " + existUser.EndDate.ToShortDateString() + " gültig!"), savedUser, false, DefaultChatTags.Notifications, ChatCategory.Info); if (existUser.LastGiftDay != DateTime.Now.Day) { GiftItem giftItem = new GiftItem(); try { savedUser.Inventory.AddItem(giftItem); } catch (Exception) { ChatManager.ServerMessageToPlayer(new LocString("Fehler beim hinzufügen"), savedUser, false, DefaultChatTags.Notifications, ChatCategory.Error); } existUser.LastGiftDay = DateTime.Now.Day; spenderUsers.Update(existUser); } if (existUser.LastBear == null || DateTime.Now.Subtract(existUser.LastBear).Days >= 30.5) { BonusBaerGoldItem bonusBaerGoldItem = new BonusBaerGoldItem(); try { savedUser.Inventory.AddItem(bonusBaerGoldItem); ChatManager.ServerMessageToPlayer(new LocString("Dein Monatlicher Goldener Bonusbär wurde deinem Inventar hinzugefügt!"), savedUser, false, DefaultChatTags.Notifications, ChatCategory.Info); } catch (Exception) { ChatManager.ServerMessageToPlayer(new LocString("Fehler beim hinzufügen des Bonus Bär Gold"), savedUser, false, DefaultChatTags.Notifications, ChatCategory.Error); } existUser.LastBear = DateTime.Now; spenderUsers.Update(existUser); } } else { ChatManager.ServerMessageToPlayer(new LocString("Willkommen im GummiBärenLand!"), user, false, DefaultChatTags.Notifications, ChatCategory.Info); } } })).Start(); }
// Sets the gift's sprite. void setSlot(GiftItem gift, Sprite giftSprite) { giftImage.sprite = giftSprite; }
public bool TryRedeemGift(GiftItem gift) { return(TryRedeemGift(gift.Value, gift.ValueType)); }
public void Init(PPHomeUIController room, GiftItem gift) { this.room = room; }
public void UpdateUIOnDataChanged() { MajorPlayer player = PlayerManager.GetInstance().MajorPlayer; if (player.rewardData == null || player.rewardData[GiftData.nID] == null) { return; } bool isReward = player.rewardData[GiftData.nID]; //Debug.Log(GiftData.nID + " " + isReward); if (isReward) { ActiveRedio(GainedBtn); } else { if (GiftData.eType == KGiftType.gtOnlineTime) { int timeCount = GiftData.nOnlineTime * 60 - (int)player.onlineTime; if (timeCount <= 0) { ActiveRedio(UnGainBtn); } else { if (curCountingGiftItem == null || curCountingGiftItem == this) { curCountingGiftItem = this; ActiveRedio(CountTimeBtn); } else { ActiveRedio(UnReachBtn); } isCounting = true; } } else if (GiftData.eType == KGiftType.gtLevel) { if (player.levelCurrent < GiftData.nLevelLimit) { ActiveRedio(UnReachBtn); } else { ActiveRedio(UnGainBtn); } } else if (GiftData.eType == KGiftType.gtCombat) { if (player.combat < GiftData.nCombatLimit) { ActiveRedio(UnReachBtn); } else { ActiveRedio(UnGainBtn); } } else { Disable(curActiveMono); } } TimeLabel.text = GiftData.Name; resize = true; }
public static void Call(IMessage message) { //IMessage response = null; int messageId = message.GetMessageId(); UnityEngine.Debug.Log("send standalon message " + messageId); switch (messageId) { case MessageDefine.CSSceneSuspendRequest: //场景暂停 SCSceneSuspendResponse suspendRes = new SCSceneSuspendResponse(); suspendRes.Result = 0; MessageHandler.Call(MessageDefine.SCSceneSuspendResponse, suspendRes); break; case MessageDefine.SCSuspendResponse: //拼图场景暂停 { SCSuspendResponse suspendResponse = new SCSuspendResponse(); suspendResponse.Result = 0; MessageHandler.Call(MessageDefine.SCSuspendResponse, suspendResponse); } break; case MessageDefine.CSSceneResumeRequest: //场景恢复 SCSceneResumeResponse resumeRes = new SCSceneResumeResponse(); resumeRes.Result = 0; MessageHandler.Call(MessageDefine.SCSceneResumeResponse, resumeRes); break; case MessageDefine.CSResumeRequest: //拼图场景恢复 { SCResumeResponse resumeResponse = new SCResumeResponse(); resumeResponse.Result = 0; MessageHandler.Call(MessageDefine.SCResumeResponse, resumeResponse); } break; case MessageDefine.CSSkillEmitRequest: //技能释放 CSSkillEmitRequest emitReq = (CSSkillEmitRequest)message; SCSkillEmitResponse emitRes = new SCSkillEmitResponse(); long propID = emitReq.PropId; emitRes.PropId = emitReq.PropId; ConfProp confProp = ConfProp.Get(propID); if (confProp == null) { emitRes.SkillId = 0; emitRes.Result = 0; MessageHandler.Call(MessageDefine.SCSkillEmitResponse, emitRes); return; } emitRes.SkillId = confProp.skillId; emitRes.Result = 1; MessageHandler.Call(MessageDefine.SCSkillEmitResponse, emitRes); break; case MessageDefine.CSSceneRewardRequest: //局内结算 #region CSSceneRewardRequest rewardRequest = (CSSceneRewardRequest)message; ConfScene confScene = ConfScene.Get(rewardRequest.SceneId); SCSceneRewardResponse rewardRes = new SCSceneRewardResponse(); rewardRes.SceneId = rewardRequest.SceneId; rewardRes.OutputCoin = confScene.outputMoney; rewardRes.OutputCash = confScene.outputCash; rewardRes.OutputVit = confScene.outputVit; rewardRes.OutputExp = confScene.outputExp; if (confScene.dropId > 0) { ConfDropOut2 dropOut = ConfDropOut2.Get(confScene.dropId); if (!string.IsNullOrEmpty(dropOut.fixed2)) { List <DropOutJsonData> rdm_datas = CommonHelper.ParseDropOut(dropOut.fixed2); for (int i = 0; i < rdm_datas.Count; i++) { GiftItem giftItem = new GiftItem(); giftItem.ItemId = rdm_datas[i].value; giftItem.Num = rdm_datas[i].count; rewardRes.GiftItems.Add(giftItem); } } } MessageHandler.Call(MessageDefine.SCSceneRewardResponse, rewardRes); #endregion break; case MessageDefine.CSBuildingListReq: //建筑物数据 #region SCBuildingListResp buildRes = new SCBuildingListResp(); BuildingInfo buildInfo = new BuildingInfo(); buildInfo.BuildingId = 1; buildInfo.Status = 1; buildRes.Infos.Add(buildInfo); MessageHandler.Call(MessageDefine.SCBuildingListResp, buildRes); #endregion break; case MessageDefine.CSTaskIdListRequest: //获取任务列表 #region //SCTaskIdListResponse taskIdListRes = new SCTaskIdListResponse(); //TaskIdInfo taskIdInfo = new TaskIdInfo(); //taskIdInfo.TaskId = 6001; //taskIdInfo.PlayerTaskId = taskIdInfo.TaskId * 10; //taskIdListRes.TaskIdInfos.Add(taskIdInfo); //MessageHandler.Call(MessageDefine.SCTaskIdListResponse, taskIdListRes); #endregion break; case MessageDefine.CSTaskListRequest: #region 任务 CSTaskListRequest taskListRequest = (CSTaskListRequest)message; if (taskListRequest.TaskIds.Count > 1) { //SCAcceptTaskNotice taskNotice = new SCAcceptTaskNotice(); if (taskListRequest.TaskIds[0] > 0) { SCTaskStatusChangeNotice taskStatusChange = new SCTaskStatusChangeNotice(); taskStatusChange.PlayerTaskId = taskListRequest.TaskIds[0] * 10; taskStatusChange.TaskId = taskListRequest.TaskIds[0]; taskStatusChange.Status = 3; MessageHandler.Call(MessageDefine.SCTaskStatusChangeNotice, taskStatusChange); } SCAcceptTaskNotice taskNotice = new SCAcceptTaskNotice(); AcceptTaskInfo acceptNewTaskInfo = new AcceptTaskInfo(); acceptNewTaskInfo.TaskId = taskListRequest.TaskIds[1]; acceptNewTaskInfo.PlayerTaskId = acceptNewTaskInfo.TaskId * 10; acceptNewTaskInfo.Status = 1; taskNotice.AcceptTasks.Add(acceptNewTaskInfo); MessageHandler.Call(MessageDefine.SCAcceptTaskNotice, taskNotice); } #endregion //SCTaskListResponse taskListRes = new SCTaskListResponse(); //TaskInfo taskInfo = new TaskInfo(); //taskInfo.TaskId = 6001; //taskInfo.Status = 1; //taskInfo.PlayerTaskId = taskInfo.TaskId * 10; //taskListRes.TaskInfos.Add(taskInfo); //MessageHandler.Call(MessageDefine.SCTaskListResponse, taskListRes); break; case MessageDefine.CSChapterListRequest: //章节 #region SCChapterListResponse chapterListRes = new SCChapterListResponse(); PlayerChapterInfo chapterInfo = new PlayerChapterInfo(); chapterInfo.PlayerChapterId = 1000; chapterInfo.ChapterId = 1; chapterInfo.Status = 1; chapterListRes.Chapters.Add(chapterInfo); MessageHandler.Call(MessageDefine.SCChapterListResponse, chapterListRes); #endregion break; case MessageDefine.CSEnterRequest: #region 拼图 SCEnterResponse enterRes = new SCEnterResponse(); enterRes.Result = 0; CSEnterRequest enterRequest = (CSEnterRequest)message; long sceneId = enterRequest.SceneId; int sceneType = (int)(sceneId / CommonData.C_SCENE_TYPE_ID); int vitConsume = 0; int seconds = 0; for (int i = 0; i < enterRequest.OfficerIds.Count; i++) { long officerId = enterRequest.OfficerIds[i]; ConfOfficer officer = ConfOfficer.Get(officerId); vitConsume += officer.vitConsume; seconds += officer.secondGain; enterRes.OfficerIds.Add(officerId); } //if (sceneType == CommonData.C_SEEK_SCENE_START_ID) //寻物 //{ //} enterRes.Seconds = seconds; enterRes.VitConsume = vitConsume; if (sceneType == CommonData.C_JIGSAW_SCENE_START_ID) //拼图 { enterRes.Seconds = 3600; } //else if (sceneType == CommonData.C_CARTOON_SCENE_START_ID) // 事件 //{ //} MessageHandler.Call(MessageDefine.SCEnterResponse, enterRes); #endregion break; case MessageDefine.CSFinishRequest: #region 拼图结束 CSFinishRequest finishRequest = (CSFinishRequest)message; SCFinishResponse finishRes = new SCFinishResponse(); finishRes.Result = 0; finishRes.SceneId = finishRequest.SceneId; Reward reward = new Reward(); reward.Percent = 100; reward.Type = 3; reward.Num = 15; finishRes.Rewards.Add(reward); MessageHandler.Call(MessageDefine.SCFinishResponse, finishRes); #endregion break; case MessageDefine.CSSearchSceneSelectOfficerReq: #region 警员 CSSearchSceneSelectOfficerReq selectOfficerReq = (CSSearchSceneSelectOfficerReq)message; int officerVitConsume = 0; int officerCostSeconds = 300; for (int i = 0; i < selectOfficerReq.OfficerIds.Count; i++) { long officerId = selectOfficerReq.OfficerIds[i]; ConfOfficer confOfficer = ConfOfficer.Get(officerId / 100); officerVitConsume += confOfficer.vitConsume; //officerCostSeconds += confOfficer.secondGain; } SCSearchSceneSelectOfficerResp selectOfficerReponse = new SCSearchSceneSelectOfficerResp(); selectOfficerReponse.VitConsume = officerVitConsume; selectOfficerReponse.CostSeconds = officerCostSeconds; MessageHandler.Call(MessageDefine.SCSearchSceneSelectOfficerResp, selectOfficerReponse); #endregion break; case MessageDefine.CSSceneEnterRequest: { #region 进入场景 CSSceneEnterRequest enterReq = (CSSceneEnterRequest)message; SCSceneEnterResponse enterResponse = new SCSceneEnterResponse(); int enterVitConsume = 0; int enterCostSeconds = 300; for (int i = 0; i < enterReq.OfficerIds.Count; i++) { long officerId = enterReq.OfficerIds[i]; ConfOfficer confOfficer = ConfOfficer.Get(officerId / 100); enterVitConsume += confOfficer.vitConsume; //enterCostSeconds += confOfficer.secondGain; enterResponse.OfficerIds.Add(officerId); } enterResponse.IsDropScene = false; string exhibit = GuidNewNodeManager.Instance.GetCommonParams(GuidNewNodeManager.sceneExhibit); string[] exhibitIdStr = exhibit.Split('|'); if (exhibitIdStr.Length > 0) { for (int i = 0; i < exhibitIdStr.Length; i++) { long exhibitId = long.Parse(exhibitIdStr[i]); //enterResponse.SceneExhibits.Add(exhibitId); enterResponse.TaskExhibits.Add(exhibitId); enterResponse.VitConsume = enterVitConsume; enterResponse.Seconds = enterCostSeconds; } MessageHandler.Call(MessageDefine.SCSceneEnterResponse, enterResponse); } #endregion } break; case MessageDefine.CSMarketItemRequest: { #region 请求时钟商店数据 CSMarketItemRequest marketItemReq = (CSMarketItemRequest)message; SCMarketItemResponse marketItemRes = new SCMarketItemResponse(); MarketItemMsg marketmsg = new MarketItemMsg(); if (marketItemReq.PropId == 4) { marketmsg.Id = 304; marketmsg.Cost = 0; marketmsg.CostType = CostType.CostCash; } marketItemRes.MarketItems = marketmsg; MessageHandler.Call(MessageDefine.SCMarketItemResponse, marketItemRes); #endregion } break; case MessageDefine.MarkeBuyRequest: { #region 购买 MarkeBuyRequest buyReq = (MarkeBuyRequest)message; MarkeBuyResponse buyRes = new MarkeBuyResponse(); PlayerPropMsg propmsg = new PlayerPropMsg(); if (buyReq.MarketItemId == 304) { //购买时钟 propmsg.PropId = 4; propmsg.Count = 1; } buyRes.Props = propmsg; MessageHandler.Call(MessageDefine.MarkeBuyResponse, buyRes); #endregion } break; case MessageDefine.CSSkillTimerEmitReq: { #region 警员技能释放 SCSkillTimerEmitResp res = new SCSkillTimerEmitResp(); res.Result = 0; MessageHandler.Call(MessageDefine.SCSkillTimerEmitResp, res); #endregion } break; case MessageDefine.CSEventEnterRequest: { #region 进入事件 SCEventEnterResponse res = new SCEventEnterResponse(); res.Result = 0; MessageHandler.Call(MessageDefine.SCEventEnterResponse, res); #endregion } break; case MessageDefine.CSEventPhaseFeedbackRequest: { #region 请求事件 CSEventPhaseFeedbackRequest request = (CSEventPhaseFeedbackRequest)message; SCEventPhaseFeedbackResponse res = new SCEventPhaseFeedbackResponse(); res.Valuation = true; res.TotalScore = 200; PhaseInfo phaseInfo = new PhaseInfo(); phaseInfo.PhaseId = (int)ConfEvent.Get(request.EventId).phases[0]; phaseInfo.PhaseTemplateId = (int)ConfEvent.Get(request.EventId).phases[0]; phaseInfo.OfficerTemplateId = 121; phaseInfo.PhaseScore = 200; res.PhaseInfos.Add(phaseInfo); MessageHandler.Call(MessageDefine.SCEventPhaseFeedbackResponse, res); #endregion } break; case MessageDefine.CSEventRewardRequest: { CSEventRewardRequest request = (CSEventRewardRequest)message; SCEventRewardResponse res = new SCEventRewardResponse(); res.Score = 200; res.Valuation = 2; SceneRewardComprise sceneReward = new SceneRewardComprise(); ConfEvent confEvent = ConfEvent.Get(request.EventId); sceneReward.OutputCash = confEvent.cashGain; //sceneReward.OutputCoin = confEvent.coinGain; //sceneReward.OutputVit = confEvent.vitGain; //sceneReward.OutputExp = confEvent.expGain; sceneReward.Type = 1; res.SceneRewardComprise.Add(sceneReward); MessageHandler.Call(MessageDefine.SCEventRewardResponse, res); } break; } }
public IActionResult AddNewGIft(GiftItem newGift) { _giftRepo.AddNewGIft(newGift); return(Created($"/api/gift/{newGift.id}", newGift)); }