/// <summary> /// 获取基础游戏数据 /// </summary> /// <param name="miniGameType"></param> /// <returns></returns> public static MiniGameBaseBean GetMiniGameData(MiniGameEnum miniGameType) { MiniGameBaseBean miniGameData = null; switch (miniGameType) { case MiniGameEnum.Cooking: miniGameData = new MiniGameCookingBean(); break; case MiniGameEnum.Barrage: miniGameData = new MiniGameBarrageBean(); break; case MiniGameEnum.Account: miniGameData = new MiniGameAccountBean(); break; case MiniGameEnum.Debate: miniGameData = new MiniGameDebateBean(); break; case MiniGameEnum.Combat: miniGameData = new MiniGameCombatBean(); break; case MiniGameEnum.Birth: miniGameData = new MiniGameBirthBean(); break; } return(miniGameData); }
/// <summary> /// 获取弹幕游戏数据 /// </summary> /// <param name="itemPreData"></param> /// <param name="miniGameData"></param> private static void GetMiniGameDataForBarrage(PreTypeForMiniGameBean itemPreData, MiniGameBaseBean miniGameData) { if (miniGameData.gameType != MiniGameEnum.Barrage) { return; } MiniGameBarrageBean miniGameBarrage = (MiniGameBarrageBean)miniGameData; switch (itemPreData.dataType) { case PreTypeForMiniGameEnum.BarrageForLaunchInterval: miniGameBarrage.launchInterval = float.Parse(itemPreData.data); break; case PreTypeForMiniGameEnum.BarrageForLaunchSpeed: miniGameBarrage.launchSpeed = float.Parse(itemPreData.data); break; case PreTypeForMiniGameEnum.BarrageForLaunchTypes: MiniGameBarrageEjectorCpt.LaunchTypeEnum[] launchTypes = StringUtil.SplitBySubstringForArrayEnum <MiniGameBarrageEjectorCpt.LaunchTypeEnum>(itemPreData.data, ','); miniGameBarrage.launchTypes = launchTypes; break; case PreTypeForMiniGameEnum.BarrageForLaunchNumber: miniGameBarrage.launchNumber = int.Parse(itemPreData.data); break; case PreTypeForMiniGameEnum.BarrageForBulletType: miniGameBarrage.bulletType = (MiniGameBarrageBulletTypeEnum)(int.Parse(itemPreData.data)); break; } }
/// <summary> /// 创建弹幕游戏数据 /// </summary> /// <param name="miniGameData"></param> /// <param name="storeInfo"></param> /// <returns></returns> private MiniGameBarrageBean CreateBarrageGameData(MiniGameBarrageBean miniGameData, StoreInfoBean storeInfo, TrophyTypeEnum type) { switch (type) { case TrophyTypeEnum.Elementary: break; case TrophyTypeEnum.Intermediate: break; case TrophyTypeEnum.Advanced: break; case TrophyTypeEnum.Legendary: break; } return miniGameData; }
/// <summary> /// 初始化弹幕游戏 /// </summary> /// <param name="gameBarrageData"></param> public void InitGameBarrage(MiniGameBarrageBean gameBarrageData) { SceneArenaManager sceneArenaManager = GameScenesHandler.Instance.manager.GetSceneManager <SceneArenaManager>(); //添加竞技场发射台坐标 if (gameBarrageData.launchNumber <= 1) { gameBarrageData.listEjectorPosition = sceneArenaManager.GetArenaForBarrageEjectorBy1(1); } else if (gameBarrageData.launchNumber == 2) { gameBarrageData.listEjectorPosition = sceneArenaManager.GetArenaForBarrageEjectorBy1(2); } else if (gameBarrageData.launchNumber == 3) { gameBarrageData.listEjectorPosition = sceneArenaManager.GetArenaForBarrageEjectorBy1(3); } //添加用户起始位置 sceneArenaManager.GetArenaForBarrageUserPositionBy1(out Vector3 userPosition); gameBarrageData.userStartPosition = userPosition; //弹幕处理初始化 MiniGameHandler.Instance.handlerForBarrage.InitGame(gameBarrageData); }