/// <summary> /// 升级某个动物栏门票等级 /// </summary> /// <param name="obj"></param> private void OnClickTestLittleZooUpLvButton(string obj) { LogWarp.LogError(" 升级某个动物栏门票等级 "); if (littleZooID != UFrame.Const.Invalid_Int) { //转换成功, 输出数字 var level = playerData.GetLittleZooModuleData(littleZooID).littleZooTicketsLevel; var ticketCell = Config.buildupConfig.getInstace().getCell(littleZooID); //获取当前需要升级的级别 int needUpLV = GetNeedUpLv(ticketCell.lvshage, level); //发送消息 //发送消息 SetValueOfPlayerData 消息体 SetDetailValueOfPlayerData.Send((int)GameMessageDefine.SetLittleZooTicketsLevelPlayerData, littleZooID, needUpLV, 0); //提升升级成功 PromptText.CreatePromptText_TestUI("开始升级动物栏门票等级+" + needUpLV); isButton = false; } else { //转换失败, 字符串不是只是数字 PromptText.CreatePromptText_TestUI("升级动物栏前先点击下动物栏"); } }
protected void OnSendExitGateCheckinCDFinish(Message msg) { var _msg = msg as SendExitGateCheckinCDFinish; var exitGate = exitGates[_msg.entryID]; int entityID = exitGate.RemoveVisitorFromQueue(); //int entityID = exitGate.visitorQueue.Dequeue(); LogWarp.LogFormat("{0} Parkingmodule recv {1}", _msg.entityID, _msg); DebugFile.GetInstance().WriteKeyFile(_msg.entityID, "{0} Parkingmodule recv {1}", _msg.entityID, _msg); #if UNITY_EDITOR if (entityID != _msg.entityID) { string e = string.Format("出口排队异常 entityID={0}, _msg.entityID={1}", entityID, _msg.entityID); throw new System.Exception(e); } #endif broadcastEntityIDs.Clear(); foreach (var val in exitGate.visitorQueue) { this.broadcastEntityIDs.Add(val); DebugFile.GetInstance().WriteKeyFile(val, "{0} BroadcastForwardOneStepInExitGateQueue by {1}", val, entityID); } BroadcastForwardOneStepInExitGateQueue.Send(broadcastEntityIDs); SendExitGateCheckinCDFinishReply.Send(_msg.entityID); AlterValue(_msg.entryID); }
/// <summary> /// 在这个状态收到这个消息,被通知走到观光位,说明在去等待位的途中就收到了, /// 直接设置标志位,在下一个状态处理 /// </summary> /// <param name="msg"></param> protected void OnWaitSeatToVisitSeat(Message msg) { var _msg = msg as WaitSeatToVisitSeat; var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity; //不是自己的 if (_msg.entityID != entity.entityID) { return; } LogWarp.LogFormat("途中收到去观光位 排位{0}", _msg.indexInVisitQueue); DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0}在状态StateVisitorChoseLittleZoo 收到{1}, tickCount={2}", entity.entityID, msg, GameManager.GetInstance().tickCount); entity.isApproveVisitSeat = true; entity.indexInVisitQueue = _msg.indexInVisitQueue; DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0}在状态StateVisitorChoseLittleZoo, 收到{1}, entity.followPath.isArrivedEnd={2}, tickCount={3}", entity.entityID, msg, entity.followPath.isArrivedEnd, GameManager.GetInstance().tickCount); if (entity.followPath.isArrivedEnd) { DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0}在状态StateVisitorChoseLittleZoo, 并且处于到达状态 收到{1}", entity.entityID, msg); } }
/// <summary> /// 点击利润按钮事件 /// </summary> public void OnClickUpGrade_ProfitCoins(string str) { //isLongPress为true则是长按状态,单点关闭 返回 if (!JudgePressButton_Profit() && isLongPress) { LogWarp.LogError("不能升级"); return; } /* 新手引导 */ if (GlobalDataManager.GetInstance().playerData.playerZoo.isGuide == true) { if (profitLevel >= 5) { return; } } SendSetParkingLevelMessageManager(); isGetCoin = false; //设置等待回复状态 //upGradeButton.enabled = false; //设置按钮不能点击 ///播放音乐 string btnSoundPath = Config.globalConfig.getInstace().BuildUpButtonMusic; SoundManager.GetInstance().PlaySound(btnSoundPath); //LogWarp.LogError("测试 单点 按钮 "); }
public override void Enter(int preStateName) { base.Enter(preStateName); var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity; DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} StateVisitorGotoExitGateEntryQueue.Enter", entity.entityID); DebugFile.GetInstance().MarkGameObject(entity.mainGameObject, "visitor_{0}_{1}_{2}", entity.entityID, (VisitorState)this.preStateName, (VisitorState)this.stateName); MessageManager.GetInstance().Regist((int)UFrameBuildinMessage.Arrived, this.OnArrived); MessageManager.GetInstance().Regist((int)GameMessageDefine.BroadcastAfterExtendSceneAndModifiedPath, this.OnBroadcastAfterExtendSceneAndModifiedPath); MessageManager.GetInstance().Regist((int)GameMessageDefine.BroadcastForwardOneStepInExitGateQueue, this.OnBroadcastForwardOneStepInExitGateQueue); MessageManager.GetInstance().Regist((int)GameMessageDefine.SendExitGateCheckinCDFinishReply, this.OnSendExitGateCheckinCDFinishReply); finishQueueStep = 0; GoToOrgPosOfQueue(entity); if (checkInCD == null) { checkInCD = new IntCD(0); } checkInCD.Stop(); LogWarp.LogFormat("{0} GoToOrgPosOfQueue step = {1}", entity.entityID, finishQueueStep); DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} GoToOrgPosOfQueue step = {1}", entity.entityID, finishQueueStep); }
protected void TickEnterCar(int deltaTimeMS) { if ((numUnderParkingCar + numGroundParkingCar) >= this.numMaxParking) { return; } ParkingSpace parkingSpace = null; this.enterCarAccumulativeTime += deltaTimeMS; if (this.enterCarAccumulativeTime >= this.enterCarSpawnInterval || !isSpawnEnterCar) { //保留超出部分 this.enterCarAccumulativeTime -= this.enterCarSpawnInterval; //生成 LogWarp.Log("SpawnEnterZooCar"); parkingSpace = groundParking.GetFreeParkingSpace(); if (parkingSpace == null) { int currGround = GetGroundParkingNumber(playerData.GetParkingCenterDataIDIndexOfDataIdx().parkingSpaceLevel); if (this.numMaxParking > currGround) { SpawnVisitorCar(EntityFuncType.VisitorCar_EnterZoo); ++numUnderParkingCar; this.isSpawnEnterCar = true; } } else { SpawnInGroundParkingCar(EntityFuncType.GroundParkingCar, parkingSpace); ++numGroundParkingCar; this.isSpawnEnterCar = true; } } }
public override void Init() { mapModel.Init(); RegistMessages(); LogWarp.Log("-->WordlMapModule init."); }
protected void ArrivedVisitorCar(FollowPathRightAngles followPath, EntityFuncType entityFuncType) { DebugFile.GetInstance().WriteKeyFile(followPath.ownerEntity.entityID, "{0} {1} ArrivedVisitorCar", followPath.ownerEntity.entityID, entityFuncType); var entity = followPath.ownerEntity as EntityVisitorCar; EntityManager.GetInstance().RemoveFromEntityMovables(entity); // 生成游客 LogWarp.Log("car -> visistor"); switch (entityFuncType) { case EntityFuncType.VisitorCar_EnterZoo: //车到了,刷下游客停车场数量 numShowParking--; ShowLeftParkingNum(numShowParking); SpawnVisitorFromCar.Send(VisitorStage.GotoZoo, EntityFuncType.Visitor_From_Car); #if DEBUG_VISIT BroadcastNum.Send((int)GameMessageDefine.BroadcastVisitorNum, numGroundParkingCar + numUnderParkingCar, 0f, 0); BroadcastNum.Send((int)GameMessageDefine.BroadcastMaxVisitorNum, numMaxParking, 0f, 0); #endif break; case EntityFuncType.VisitorCar_LeaveZoo: break; } }
public static PlayerData Load() { LogWarp.Log("PlayerData.Load"); var playerData = GlobalDataManager.GetInstance().playerData; if (playerData == null) { LogWarp.Log("PlayerData.LoadFromPlayerPrefs"); playerData = LoadFromPlayerPrefs(); GlobalDataManager.GetInstance().playerData = playerData; } //playerData.playerZoo.currSceneID = GetcurrSceneIDByStar(playerData); //单场景数据迁移到多场景数据 SingleSceneDataToMultiSceneData(playerData); //多场景数据迁移到多场景多布局 MultiSceneDataToMultiStyleSceneData(playerData); //多场景多布局迁移到多种金币 MultiStyleSceneDataToMultiCoinSceneData(playerData); //设置最后解锁的场景 SetLastOpenScene(playerData); NewAnimalDataToPlayerAnimal_MSS_15(playerData); return(playerData); }
protected void OnArrived(Message msg) { var _msg = msg as MessageArrived; var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity; //自己的entity if (_msg.followPath.ownerEntity.entityID != entity.entityID) { return; } //先判断走到起点 if (_msg.followPath.isArrivedEnd && !isArrivedStartOfPath) { isArrivedStartOfPath = true; EntityVisitor.GodownPath(entity, pathOfGotoLittleZoo); return; } if (_msg.followPath.isArrivedEnd && !isArrivedLittleZoo) { LogWarp.Log("到达动物栏,准备走向等待位"); isArrivedLittleZoo = true; entity.stayBuildingID = this.stayBuildingID; entity.stayGroupID = this.stayGroupID; isToEnterLittleZooApply = true; return; } }
public void Start() { var pd = GlobalDataManager.GetInstance().playerData; if (pd.isFirstInstall) { //ThirdPartTA.Identify(); //ThirdPartTA.StartTrack(); //ThirdPartTA.Track(TAEventsMonitorEnum.register); } else { //ThirdPartTA.StartTrack(); } //ThirdPartTA.Track(TAEventsMonitorEnum.gamestart); //ThirdPartTA.TrackAppInstall(); //每次登录写last_login_time //LogWarp.Log("ThirdPartTA.UserSet.last_login_time"); //var taParam = new Dictionary<string, object>(); //taParam.Add("last_login_time", DateTime.Now); //ThirdPartTA.UserSet(taParam); LogWarp.Log("LoadingMgr.Inst.isRunning = true"); LoadingMgr.Inst.isRunning = true; }
public int RemoveVisitorFromVisitQueue(int entityID) { #if UNITY_EDITOR if (entityID == Const.Invalid_Int) { string e = "entityID 异常"; throw new System.Exception(e); } #endif int idx = visitQueue.IndexOf(entityID); #if UNITY_EDITOR if (idx < 0) { for (int i = 0; i < visitQueue.Count; i++) { LogWarp.LogError(visitQueue[i]); } string e = string.Format("观光位上没有这个游客 {0}", entityID); throw new System.Exception(e); } #endif visitQueue[idx] = Const.Invalid_Int; return(idx); }
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("测试: 视频播放 失败"); } }
private void OnTestMultiIntCD() { //multiTickObj = new MultiIntCD(); LogWarp.LogErrorFormat("运行并添加 multiTickObj"); //multiTickObj.Run(); //multiTickObj.AddCD(1000, Test01); //multiTickObj.AddCD(5000, Test02); }
/// <summary> /// 小游戏失败 /// </summary> /// <param name="obj"></param> private void OnGetCrossRoadGameFailure(Message obj) { gameModules.Stop(); //弹出UI 失败 LogWarp.LogError("游戏失败"); PageMgr.ShowPage <UIGameFailPage>(); }
/// <summary> /// 测试不包含buff的/m /// </summary> private void OnTestNoBuff() { var incomeCoinMS01 = PlayerDataModule.CurrScenePerMinCoin(true); var incomeCoinMS02 = PlayerDataModule.LeaveScenePerMinCoin(1, true); LogWarp.LogError("测试: 附带buff的" + MinerBigInt.ToDisplay(incomeCoinMS01)); LogWarp.LogError("测试: 不带buff的" + MinerBigInt.ToDisplay(incomeCoinMS02)); }
/// <summary> /// 测试:动物购买 /// </summary> private void OnTestDeactiveAnimal() { LogWarp.LogError("测试:: 删除动物"); // LittleZooModule.DeactiveAnimal(1001, 10101); Dictionary <int, EntityMovable> entityMovables = EntityManager.GetInstance().entityMovables; EntityManager.GetInstance().RemoveFromEntityMovables(entityMovables[entityMovables.Count - 1]); }
/// <summary> /// 返回当前等级在等级段的差距 /// </summary> /// <param name="array"></param> /// <param name="level"></param> /// <returns></returns> private int GetNeedUpLv(int[] array, int level) { int idx = PlayerDataModule.FindLevelRangIndex(array, level); int needLv = array[idx] - level; LogWarp.LogErrorFormat(" 测试: 当前等级 {0} 在数组下标{1} 需要的等级{2} ", level, idx, needLv); return(needLv); }
/// <summary> /// 观看视频翻倍 /// </summary> /// <param name="obj"></param> private void OnClickReceiveButton(string obj) { LogWarp.LogError(" 观看视频翻倍 "); SendIncreaseCrossRoadStageID(); //SetValueOfPlayerData.Send((int)GameMessageDefine.AddCoinOfPlayerDataMSSC, 0, cellStage.firstgoldreward*2, 0); //CrossRoadStageManager.GetInstance().UnLoad(); //ZooGameLoader.GetInstance().BackFromCrossRoad(); }
protected void WhenCheckinCDFinished() { var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity; var msg = SendExitGateCheckinCDFinish.Send(entity.entityID, entity.ExitGateEntryID); LogWarp.LogFormat("{0} send {1}", entity.entityID, msg); DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} send {1}", entity.entityID, msg); }
protected void OnAddVisitorToEntryQueuePlaceHolderApply(Message msg) { var _msg = msg as AddVisitorToEntryQueuePlaceHolderApply; LogWarp.LogFormat("{0} EntryGateModule recv {1}", _msg.entityID, _msg); DebugFile.GetInstance().WriteKeyFile(_msg.entityID, "{0} EntryGateModule recv {1}", _msg.entityID, _msg); bool result = false; int entryID = Const.Invalid_Int; int indexInQueue = Const.Invalid_Int; this.idleGates.Clear(); if (this.isOnlyOneEntry) { var exitGate = entryGates[1]; if (!exitGate.IsQueueFull()) { this.idleGates.Add(exitGate); } //保留最后一个遍历的 entryID = exitGate.entryID; } else { foreach (var kv in this.entryGates) { if (!kv.Value.IsQueueFull()) { this.idleGates.Add(kv.Value); } //保留最后一个遍历的 entryID = kv.Value.entryID; } } //LogWarp.LogFormat("还能排队的入口数{0}", idleEntrys.Count); EntryGate idleGate = null; string pathName = null; if (idleGates.Count > 0) { int rVal = 0; if (isRandomEntry) { rVal = Random.Range(0, idleGates.Count); } idleGate = idleGates[rVal]; result = true; entryID = idleGate.entryID; pathName = idleGate.pathName; idleGate.AddVisitorPlaceHolder(_msg.entityID); LogWarp.LogFormat("给出的排队位{0}", indexInQueue); } //AddVisitorToEntryQueuePlaceHolderReply.Send(result, _msg.entityID, pathName, indexInQueue, entryID); AddVisitorToEntryQueuePlaceHolderReply.Send(result, _msg.entityID, pathName, entryID); //AddVisitorToEntryQueuePlaceHolderReply.Send(false, _msg.entityID, pathName, entryID); AlterValue(entryID); }
public static void GotoNextPos(EntityVisitor entity, Vector3 pos) { entity.pathList.Clear(); entity.pathList.Add(entity.position); entity.pathList.Add(pos); entity.followPath.Init(entity, entity.pathList, entity.pathList[0], 0, entity.moveSpeed, false); entity.followPath.Run(); LogWarp.Log("GotoNextPos "); }
public static AddVisitorToLittleZooApply Send(int entityID, bool isFirstApply) { LogWarp.LogFormat("AddVisitorToLittleZooApply {0}, {1} ", entityID, isFirstApply); var msg = pool.New(); msg.Init(entityID, isFirstApply); MessageManager.GetInstance().Send(msg); return(msg); }
public void FinishTrace() { //for (int i = 0; i < otherCtrs.Count; i++) //{ // otherCtrs[i].enabled = true; //} LogWarp.Log("相机跟随结束"); isTrace = false; }
protected void OnAddVisitorToEntryQueuePlaceHolderReply(Message msg) { var _msg = msg as AddVisitorToEntryQueuePlaceHolderReply; var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity; if (_msg.entityID != entity.entityID) { return; } //无论成功失败,都有入口ID entity.zooEntryID = _msg.entryID; DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} 在VisitorGotoZooEntry状态 收到{1}", entity.entityID, msg); if (!_msg.result) { LogWarp.Log("入口所有排队满了, 准备离开, 转离开"); DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} 在VisitorGotoZooEntry状态 收到{1}入口所有排队满了, 准备离开, 转离开", entity.entityID, msg); this.isToVisitorStateLeaveZooEntryQueueFull = true; return; } isHold = true; Vector3 endPos = UnityEngine.Vector3.zero; EntityFuncType entityFuncType = (EntityFuncType)(entity.entityFuncType); switch (entityFuncType) { case EntityFuncType.Visitor_From_Ship: entity.pathList.Clear(); entity.pathList.Add(entity.position); endPos = UnityEngine.Vector3.zero; PathManager.GetInstance().GetPathLastPos(_msg.pathName, ref endPos); entity.pathList.Add(endPos); EntityVisitor.GodownPath(entity, entity.pathList); break; case EntityFuncType.Visitor_From_Car: EntityVisitor.GodownPath(entity, _msg.pathName, true); break; case EntityFuncType.Visitor_From_GroundParking: entity.pathList.Clear(); entity.pathList.Add(entity.position); endPos = Vector3.zero; PathManager.GetInstance().GetPathLastPos(_msg.pathName, ref endPos); entity.pathList.Add(endPos); EntityVisitor.GodownPath(entity, entity.pathList, true); break; default: string e = string.Format("没有这种游客类型{0}", entityFuncType); throw new System.Exception(e); } }
protected void CalcMaxParkingNum() { #if DEBUG_VISIT numMaxParking = GetParkingNumber(2000); #else numMaxParking = GetParkingSpace(); #endif LogWarp.LogFormat("parking numMaxParking = {0}", numMaxParking); }
/// <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); }
protected void InitPlayerData() { if (isUsedData) { return; } LogWarp.Log("DeleteKey"); PlayerPrefs.DeleteKey("PlayerData"); }
protected void OnNotFoundMessage(int messageID) { if (messageID < 10001) { LogWarp.LogErrorFormat("消息未注册 {0}", (UFrameBuildinMessage)messageID); return; } LogWarp.LogErrorFormat("消息未注册 {0} {1}", (GameMessageDefine)messageID, (int)(GameMessageDefine)messageID); }
public void WriteKeyFile(int key, string format, params object[] args) { #if UNITY_EDITOR string content = string.Format(format, args); LogWarp.LogFormat(content); string keyFilePath = string.Format("{0}{1}.txt", debugFileDir, key); string lineContent = string.Format("{0}|{1}\r\n", System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff"), content); File.AppendAllText(keyFilePath, lineContent, Encoding.UTF8); #endif }