protected void OnGetItemStar(int itemID, Config.itemCell itemCell) { int star = 0; if (!int.TryParse(itemCell.itemval, out star)) { #if UNITY_EDITOR string e = string.Format("Star 数量不是数字型{0}, {1}", itemID, itemCell.itemval); throw new System.Exception(e); #endif return; } ItemUse eItemUse = (ItemUse)(itemCell.use); switch (eItemUse) { case ItemUse.Get_Effective: SetValueOfPlayerData.Send((int)GameMessageDefine.SetStarOfPlayerData, star, 0, 0); break; case ItemUse.Use_Effective: //var item = ItemCellToItem(itemID, itemCell); playerData.playerZoo.itemList.Add(itemID); break; default: #if UNITY_EDITOR string e = string.Format("没有这种道具使用类型 {0}, {1}", itemID, itemCell.use); throw new System.Exception(e); #endif return; } }
private void OnGetIsLockAdsSucceedBool(bool isBool) { #if TEST_NO_AD_SHOW isBool = true; #endif Config.monitorCell cell; if (isBool == true) { switch (condition) { case "TouristButton": LogWarp.LogError("测试 进入观看广告时间 touristButton "); EntityShip.GetoffVisitor(numberVisitor); //轮船游客到来 playerData.playerZoo.playerNumberOfVideosWatched.SetNumberOfVideoViews(AdTagFM.Add_Tourist_Advert); AdWatchComplete.Send(AdWatchComplete.AdType_RewardedVideo, AdTagFM.Add_Tourist_Advert.ToString()); break; case "VisitButton": BroadcastNum.Send((int)GameMessageDefine.AddBuff, 10, 0, 0); //动物栏观光时间 playerData.playerZoo.playerNumberOfVideosWatched.SetNumberOfVideoViews(AdTagFM.Add_Visit_Advert); MessageManager.GetInstance().Send((int)GameMessageDefine.ImmediateFinishVisitCD); break; case "TicketButton": BroadcastNum.Send((int)GameMessageDefine.AddBuff, 12, 0, 0); //售票口时间 playerData.playerZoo.playerNumberOfVideosWatched.SetNumberOfVideoViews(AdTagFM.Add_Ticket_Advert); AdWatchComplete.Send(AdWatchComplete.AdType_RewardedVideo, AdTagFM.Add_Ticket_Advert.ToString()); MessageManager.GetInstance().Send((int)GameMessageDefine.ImmediateFinishEntryGateCheckInCD);; break; case "FreeItemButton": SetValueOfPlayerData.Send((int)GameMessageDefine.AddCoinOfPlayerDataMSSC, 0, freeItemRwdCoinQuantity, 0); //贵宾定时广告 GameManager.GetInstance().StartCoroutine(FinishMoneyEffect()); playerData.playerZoo.playerNumberOfVideosWatched.SetNumberOfVideoViews(AdTagFM.Add_Viptiming_Advert); AdWatchComplete.Send(AdWatchComplete.AdType_RewardedVideo, AdTagFM.Add_Viptiming_Advert.ToString()); break; default: break; } playerNumberOfVideosWatched = playerData.playerZoo.playerNumberOfVideosWatched; //利用dotweeen做延时操作 防止穿透 float timeCount = 0.1f; DOTween.To(() => timeCount, a => timeCount = a, 0.1f, 0.1f).OnComplete(new TweenCallback(delegate { this.Hide(); })); } else { LogWarp.LogError("测试: 视频播放 失败"); } }
protected void OnTestAddCoin() { //点一下,把当前的金币变成2倍 var pd = GlobalDataManager.GetInstance().playerData; var addCoin = pd.playerZoo.playerCoin.GetCoinByScene(pd.playerZoo.currSceneID).coinBigInt; SetValueOfPlayerData.Send((int)GameMessageDefine.AddCoinOfPlayerDataMSSC, 0, addCoin, 0); }
/// <summary> /// 发送消息离线的收益 /// 奖励金币数可能是正常离线收益,也可能是广告离线收益 /// 具体数目由参数rewardCoin提供 /// </summary> /// <param name="rewardCoin"></param> private void ActualEarnings(BigInteger rewardCoin) { //离线时间清0 GlobalDataManager.GetInstance().offlineSeconds = 0; SetValueOfPlayerData.Send((int)GameMessageDefine.AddCoinOfPlayerDataMSSC, 0, rewardCoin, 0); this.HideUICallBack(); }
/// <summary> /// 增加当前金钱 /// </summary> /// <param name="obj"></param> private void OnClickTestAddCoinButton(string obj) { LogWarp.LogFormat("AAAAAAAAAAAAAAA"); //点一下,把当前的金币变成2倍 var pd = GlobalDataManager.GetInstance().playerData; var addCoin = pd.playerZoo.playerCoin.GetCoinByScene(pd.playerZoo.currSceneID).coinBigInt; SetValueOfPlayerData.Send((int)GameMessageDefine.AddCoinOfPlayerDataMSSC, 0, addCoin, 0); }
/// <summary> /// 清除当前金币 /// </summary> /// <param name="obj"></param> private void OnClickTestClearCoinButton(string obj) { var pd = GlobalDataManager.GetInstance().playerData; var addCoin = pd.playerZoo.playerCoin.GetCoinByScene(pd.playerZoo.currSceneID).coinBigInt; SetValueOfPlayerData.Send((int)GameMessageDefine.AddCoinOfPlayerDataMSSC, 0, -addCoin, 0); GlobalDataManager.GetInstance().leaveSceneCoinData.LeaveSceneCoinDict.Clear(); }
private void SendSetParkingCoolingLevelMessageManager() { if (enterCarSpawnLevel >= parkingEnterCarSpawnMaxGrade) { SwitchButtonUnClickable(enterCarSpawn_Button, false); return; } SetValueOfPlayerData.Send((int)GameMessageDefine.SetParkingEnterCarSpawnLevelOfPlayerData, 1, 0, 0); }
private void SendSetParkingSpaceLevelMessageManager() { if (parkingSpaceLevel >= parkingSpaceMaxGrade) { //parkingSpace_Button.enabled = false; SwitchButtonUnClickable(parkingSpace_Button, false); //parkingSpace_Button_ButtonLvUpText.color = Color.red; return; } SetValueOfPlayerData.Send((int)GameMessageDefine.SetParkingSpaceLevelOfPlayerData, 1, 0, 0); }
/// <summary> /// 点击开启新的售票口事件 /// </summary> public void OnClickOpenNewEntry() { //获取下一个应该开启的ID int ID = playerData.GetEntryDateDataIDIndexOfDataIdx().entryGateList[playerData.GetEntryDateDataIDIndexOfDataIdx().entryGateList.Count - 1].entryID; SetValueOfPlayerData.Send((int)GameMessageDefine.SetEntryGateNumOfPlayerData, 1, 0, ID + 1); isGetCoin = false; //设置等待回复状态 ///播放音乐 string btnSoundPath = Config.globalConfig.getInstace().BuildUpButtonMusic; SoundManager.GetInstance().PlaySound(btnSoundPath); }
protected void OnUseItemStar(int itemID, Config.itemCell itemCell) { int star = 0; if (!int.TryParse(itemCell.itemval, out star)) { #if UNITY_EDITOR string e = string.Format("Star 数量不是数字型{0}, {1}", itemID, itemCell.itemval); throw new System.Exception(e); #endif return; } SetValueOfPlayerData.Send((int)GameMessageDefine.SetStarOfPlayerData, star, 0, 0); }
protected void OnUseItemCoin(int itemID, Config.itemCell itemCell) { BigInteger coin = 0; if (!BigInteger.TryParse(itemCell.itemval, out coin)) { #if UNITY_EDITOR string e = string.Format("Coin 数量不是数字型{0}, {1}", itemID, itemCell.itemval); throw new System.Exception(e); #endif return; } SetValueOfPlayerData.Send((int)GameMessageDefine.AddCoinOfPlayerDataMSSC, 0, coin, 0); }
/// <summary> /// 只算第一个场景的 /// </summary> /// <param name="deltaTimeMs"></param> protected void ZooAddCoin(int deltaTimeMs) { var perMinCoin = PlayerDataModule.LeaveScenePerMinCoin( GameConst.First_SceneID, true); var deltaCoin = perMinCoin * deltaTimeMs / 60000; SetValueOfPlayerData.Send((int)GameMessageDefine.AddCoinOfPlayerDataMSSC, 0, deltaCoin, 0); //var sceneStates = playerData.playerZoo.scenePlayerDataMSS.sceneStates; //bool isCalcFirst = false; //for (int i = 0; i < sceneStates.Count; i++) //{ // var sceneState = sceneStates[i]; // if (sceneState.enterCount > 0) // { // if (sceneState.sceneId == GameConst.First_SceneID) // { // isCalcFirst = true; // } // var perMinCoin = PlayerDataModule.LeaveScenePerMinCoin(sceneState.sceneId, true); // var deltaCoin = perMinCoin * deltaTimeMs / 60000; // if (perMinCoin > 0) // { // playerData.playerZoo.playerCoin.AddCoinByScene(sceneState.sceneId, deltaCoin); // } // } //} ////防止场景数据中没有第一个场景 //if (!isCalcFirst) //{ // var perMinCoin = PlayerDataModule.LeaveScenePerMinCoin(GameConst.First_SceneID, true); // var deltaCoin = perMinCoin * deltaTimeMs / 60000; // if (perMinCoin > 0) // { // playerData.playerZoo.playerCoin.AddCoinByScene(GameConst.First_SceneID, deltaCoin); // } //} }
/// <summary> /// 发送消息(奖励) /// </summary> private void SendCrossRoadAward() { SetValueOfPlayerData.Send((int)GameMessageDefine.SetDiamondOfPlayerData, coin, 0, 0); playerData.playerLittleGame.isFirst = false; }
/// <summary> /// 设置入口数量 /// </summary> /// <param name="msg"></param> protected void OnSetEntryGateNumOfPlayerData(Message msg) { var _msg = msg as SetValueOfPlayerData; //var sortGateIDs = GlobalDataManager.GetInstance().playerData.playerZoo.GetSortTicketConfigGateIDs(); //int sceneID = GlobalDataManager.GetInstance().playerData.playerZoo.currSceneID; var entryGateList = playerData.GetEntryDateDataIDIndexOfDataIdx().entryGateList; int number = entryGateList.Count - 1; int currLastEntryID = entryGateList[number].entryID; int idx = sortGateIDs.IndexOf(currLastEntryID); #if UNITY_EDITOR if (idx < 0) { //string e = string.Format("设置入口开启异常! 原来{0} 增加 {1}", playerData.playerZoo.numEntryGate, _msg.deltaVal); //throw new System.Exception(e); } #endif //已经开完了。 if (idx == sortGateIDs.Count - 1) { return; } int entryID = 0; for (int i = idx + 1; i < idx + 1 + _msg.deltaVal; i++) { int subscript = this.playerData.GetSceneIDGoToEntryDataListSubscript(); var entryGateData = new GateData { entryID = sortGateIDs[i], level = 1 }; entryID = sortGateIDs[i]; this.playerData.playerZoo.entryGateList_MS[subscript].entryGateList.Add(entryGateData); } this.playerData.playerZoo.numEntryGate += _msg.deltaVal; //开启扣钱 var parce = Config.ticketConfig.getInstace().getCell(idx).number; BigInteger bigDelta = BigInteger.Parse(parce); //bool retCode = VaryDataCoin(bigDelta); //if (!retCode) //{ // string e = string.Format("售票口开启扣钱失败"); // throw new System.Exception(e); // return; //} ////广播金钱变化 //BroadcastValueOfPlayerData.Send((int)GameMessageDefine.BroadcastCoinOfPlayerData, //0, 0, BigInteger.Parse(GlobalDataManager.GetInstance().playerData.playerZoo.coin), bigDelta); if (!playerData.playerZoo.playerCoin.WarpAddCoin(playerData, -bigDelta)) { return; } //广播新开启了几个入口 SetValueOfPlayerData.Send((int)GameMessageDefine.BroadcastEntryGateNumOfPlayerData, entryID, 0, _msg.channelID); }
/// <summary> /// 增加钻石 /// </summary> /// <param name="obj"></param> private void OnClickTestAddDiamondButton(string obj) { //LogWarp.LogError("增加钻石"); SetValueOfPlayerData.Send((int)GameMessageDefine.SetDiamondOfPlayerData, 1000, 0, 0); }
public void SetNumberOfVideoViews(AdTagFM adTagFM) { switch (adTagFM) { case AdTagFM.Add_Double_Advert: if (playerLockGainDoubleAdsVideoCount < Config.globalConfig.getInstace().GoldRewardMaxNumber) { playerLockGainDoubleAdsVideoCount += 1; if (playerLockGainDoubleAdsVideoCount == Config.globalConfig.getInstace().GoldRewardMaxNumber) { var rewardNumCoin = PlayerDataModule.AllScenePerMinCoin(true) * Config.globalConfig.getInstace().AdvertGoldReward; //加钱 SetValueOfPlayerData.Send((int)GameMessageDefine.AddCoinOfPlayerDataMSSC, 0, rewardNumCoin, 0); float timeCount = 0.1f; DOTween.To(() => timeCount, a => timeCount = a, 0.1f, 0.1f).OnComplete(new TweenCallback(delegate { UIMainPage uIMainPage = PageMgr.GetPage <UIMainPage>(); uIMainPage.OnMoneyEffect(); //飘钱特效 })); } } break; case AdTagFM.Add_Tourist_Advert: playerLockVisitorNumberAdsVideoCount += 1; break; case AdTagFM.Add_Ticket_Advert: playerLockEntryExpediteAdsVideoCount += 1; break; case AdTagFM.Add_Visit_Advert: playerLockVisitorExpediteAdsVideoCount += 1; break; case AdTagFM.Add_Offline_Advert: playerLockOfflineAdsVideoCount += 1; break; case AdTagFM.Add_Viptiming_Advert: playerFreeItemAdsVideoCount += 1; break; default: break; } playerWatchAdsVideoCount += 1; if (adTagFM == AdTagFM.Add_Double_Advert) { } if (playerWatchAdsVideoCount == Config.globalConfig.getInstace().AdvertRewardNumber) { var rewardNum = Config.globalConfig.getInstace().AdvertRewardRmbNumber; //加钻石 SetValueOfPlayerData.Send((int)GameMessageDefine.SetDiamondOfPlayerData, rewardNum, 0, 0); LogWarp.LogErrorFormat("看广告6次 增加了钻石"); playerWatchAdsVideoCount = 0; } }
/// <summary> /// 免费气球广告 /// </summary> private void LockAdsSucceed_FreeItem() { SetValueOfPlayerData.Send((int)GameMessageDefine.AddCoinOfPlayerDataMSSC, 0, freeItemRwdCoinQuantity, 0); //贵宾定时广告 GameManager.GetInstance().StartCoroutine(FinishMoneyEffect()); playerData.playerZoo.playerNumberOfVideosWatched.SetNumberOfVideoViews(AdTagFM.Add_Viptiming_Advert); }