public void SetInfo() { level.text = string.Format("LV.{0}", GameConfigs.SkillLevel(skillType)); cost.text = GameStatics.GetRequiredShardsForUpgrade(skillType).ToString(); switch (skillType) { case GameStatics.SKILL_TYPE.MAXHP: int currentHPAmount = PlayerManager.Instance().PlayerStatus.MaxHP; expect.text = string.Format("{0} > {1}", currentHPAmount, currentHPAmount + (GameStatics.default_IncHP)); break; case GameStatics.SKILL_TYPE.AIRTIME_DURATION: double currentDJCoolAmount = PlayerManager.Instance().PlayerStatus.AirTimeDuration; expect.text = string.Format("{0:0.0} > {1:0.0}", currentDJCoolAmount, currentDJCoolAmount + (GameStatics.default_IncAirTimeDuration)); break; case GameStatics.SKILL_TYPE.SHARD_PULL_DIST: double currentSPDist = GameStatics.GetShardPullDistance(); expect.text = string.Format("{0:0.0} > {1:0.0}", currentSPDist, currentSPDist + (GameStatics.default_IncShardsPullDistance)); break; default: break; } SetUpgradeStatus(); }
public GameTimerModel() { gc = GameConfigs.GetInstance(); Region = new Rectangle(gc.GetRealPoint(7.5f, 0.5f), new Point(0, 0)); position = new Vector2(Region.X, Region.Y); State = DynamicState.END; }
public void OnCloseClick() { //Close(); Sprite sp = AssetManager.Instance.LoadAsset <Sprite>(GameConfigs.GetSpritePath("button_green")); testImg.sprite = sp; }
public static GameSettings Make(GameConfigs configs) { eGame gameType = configs._gameType; if (gameType == eGame.Sandbox) { return(new GameSettings(configs)); } else if (gameType == eGame.Exodus) { return(new GameSettings(eGame.Exodus, eEndCondition.Survival, new MapSettings(configs._mapConfigs), PlayerSettings.ExodusSettings(), TickSettings.ExodusSettings())); } else if (gameType == eGame.HotSeat) { return(new GameSettings(eGame.HotSeat, eEndCondition.LastOneStanding, MapSettings.HotseatSettings(), new PlayerSettings(configs._playerConfigs), TickSettings.HotseatSettings())); } else { throw new System.NotImplementedException(); } }
public static void ParseCfgs <T>(string json) where T : GameConfig { var type = typeof(T).Name; GameConfigs <T> cfgs = null; #if UNITY_EDITOR || UNITY_STANDALONE || UNITY_ANDROID || UNITY_IOS cfgs = JsonUtility.FromJson <GameConfigs <T> >(json); #else cfgs = Utf8Json.JsonSerializer.Deserialize <GameConfigs <T> >(json); #endif foreach (var config in cfgs.Configs) { var id = config.Id; _configs[id] = config; Log($" >Loaded config {config.Id}"); if (id.Contains(_wildmaskMark)) { _wildCards.Add(id); Log($" >>Loaded wildcard config {config.Id}"); } } }
public LineBonusEffect(LineBonusEffectDirection direction) { Direction = direction; gc = GameConfigs.GetInstance(); State = DynamicState.RUN; BonusType = direction == LineBonusEffectDirection.BT || direction == LineBonusEffectDirection.TB ? BonusEffect.LINE_V : BonusEffect.LINE_H; }
public void OnClickChangePlayMode() { if (PlayerManager.Instance().PlayMode == PLAY_MODE.NORMAL) { PlayerManager.Instance().PlayMode = PLAY_MODE.TRUE; GameConfigs.SetLastPlayMode(PLAY_MODE.TRUE); Show_NormalObject.SetActive(false); Show_Ending1Object.SetActive(true); SoundManager.PlayLoopingMusic(SoundContainer.Instance().BackGroundMusicsDic["BGM_Ending"], 1.0f, 1.0f, true); } else { PlayerManager.Instance().PlayMode = PLAY_MODE.NORMAL; GameConfigs.SetLastPlayMode(PLAY_MODE.NORMAL); Show_NormalObject.SetActive(true); Show_Ending1Object.SetActive(false); SoundManager.PlayLoopingMusic(SoundContainer.Instance().BackGroundMusicsDic["Opening"], 1.0f, 1.0f, true); } SetChangeModeText(PlayerManager.Instance().PlayMode); ChangeModeCameraTween.Begin(); ChangeModeCameraTween.vector3Results = ChangeModeCameraTween.startingVector; SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_explosion1], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_explosion1].clip); }
public void ShowUpgradeUI(bool isShow) { if (isShow) { GameConfigs.SetCurrentMemoryShards(PlayerManager.Instance().PlayerStatus.CurrentMemoryShards); upgradeUITweener.gameObject.SetActive(true); upgradeUITweener.startingVector = outXPos_upgradeUI; upgradeUITweener.endVector = inXPos_upgradeUI; SetUpgradeInfos(upgradeElements); Vibration.Vibrate(100); SoundManager.StopAllLoopingSounds(); if (onCameraShake != null) { onCameraShake(5); } } else { upgradeUITweener.startingVector = inXPos_upgradeUI; upgradeUITweener.endVector = outXPos_upgradeUI; upgradeUITweener.TweenCompleted += DeactiveUpgradeUIAfterTweenComplete; currentGameUIStatus = TOPUI_STATUS.NORMAL; } isShowingUpgradeUI = isShow; upgradeUITweener.Begin(); upgradeUITweener.defaultVector = upgradeUITweener.startingVector; }
public static int GetRequiredShardsForUpgrade(SKILL_TYPE skillType) { int result = int.MaxValue; switch (skillType) { case SKILL_TYPE.MAXHP: const int default_IncHPShards = 10; result = (GameConfigs.SkillLevel(skillType) + 1) * default_IncHPShards; break; case SKILL_TYPE.AIRTIME_DURATION: const int default_IncCoolShards = 30; result = (GameConfigs.SkillLevel(skillType) + 1) * default_IncCoolShards; break; case SKILL_TYPE.SHARD_PULL_DIST: const int default_IncDistShards = 40; result = (GameConfigs.SkillLevel(skillType) + 1) * default_IncDistShards; break; default: break; } return(result); }
public void OnChangeSoundSlider() { if (slider_bgm != null && slider_sfx != null) { GameConfigs.SetVolume(slider_bgm.value, slider_sfx.value); } }
public PlayController() : base(ControllerNames.Play) { Rectangle[,] regions = new Rectangle[8, 8]; gc = GameConfigs.GetInstance(); for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { regions[i, j] = new Rectangle(gc.GetRealPoint(j + 1, i + 1), new Point(gc.RegionWidth, gc.RegionHeight)); } } gameMatrix = new GameMatrix(regions, 8, 8); gameModel = new GameModel(gameMatrix); gameMatrix.OnItemKilled += () => { bonusPointsModel.Points += 1; }; gameTimerModel = new GameTimerModel(); bonusPointsModel = new BonusPointsModel(); gameModel.Timer = gameTimerModel; gameModel.BonusPoints = bonusPointsModel; renderer = new PlayRenderer(gameModel); gameTimerModel.Start(); }
public void Awake() { Configs = GameConfigs.Load( "bonuses", "weapons", "players", "pools", "images", "maps", "levelsSingle", " "); HeroId = SystemInfo.deviceUniqueIdentifier; MapOfflineConfig = Configs.Map["sample"]; rand = new Random(); }
public override void Init() { base.Init(); //加载uiRootprefab , 加载依赖AssetManager,需要保证AssetManager已经完成了初始化 var uiSetting_prefab = AssetManager.Instance.LoadAsset <UISetting>(GameConfigs.GetUIPath("UIRoot")); _uiSetting = GameObject.Instantiate <UISetting>(uiSetting_prefab, this.transform); Debug.Assert(_uiSetting != null, "初始化UI管理器失败!"); }
// Start(), Update()が含まれます // #region GameProcess /// <summary> /// Use this for initialization /// </summary> void Start() { gc = GameObject.FindWithTag("Config").GetComponent <GameConfigs>(); //Array.Resize(ref blf, gc.KeyCollectionLength); //blf = gameObject.GetComponentsInChildren<BeamLineFixed>(); KeyAsign(); MaskAsign(); }
void LoadConfigs() { _gameConfigObject = Resources.Load(_gameConfigsPath, typeof(TextAsset)); var currentJson = _gameConfigObject as TextAsset; if (currentJson != null) { _currentGameConfigs = JsonUtility.FromJson <GameConfigs>(currentJson.text); } }
private void OnApplicationPause(bool pause) { if (pause) { GameConfigs.SetPlayTime(TopMostControl.Instance().playUnixTime); } else { //Time_LatestStartGame = DateTime.UtcNow; } }
public GameSettings(GameConfigs configs) { _gameType = configs._gameType; _endCondition = configs._endCondition; _mapSettings = new MapSettings(configs._mapConfigs); _playerSettings = new PlayerSettings(configs._playerConfigs); _tickSettings = new TickSettings(configs._tickConfigs); }
public static void Vibrate() { if (GameConfigs.GetIsVibrate()) { if (isAndroid()) { vibrator.Call("vibrate"); } else { Handheld.Vibrate(); } } }
public static void Vibrate(long milliseconds) { if (GameConfigs.GetIsVibrate()) { if (isAndroid()) { vibrator.Call("vibrate", milliseconds); } else { Handheld.Vibrate(); } } }
public static void Vibrate(long[] pattern, int repeat) { if (GameConfigs.GetIsVibrate()) { if (isAndroid()) { vibrator.Call("vibrate", pattern, repeat); } else { Handheld.Vibrate(); } } }
void OnClickGameOverMenu(MENU_GAMEOVER gameOverMenu) { switch (gameOverMenu) { case MENU_GAMEOVER.MAINMENU: // Save Memory Shards.. GameConfigs.SetCurrentMemoryShards(PlayerStatus.CurrentMemoryShards); SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_select], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_select].clip); break; case MENU_GAMEOVER.RETRY: // Save Memory Shards.. GameConfigs.SetCurrentMemoryShards(PlayerStatus.CurrentMemoryShards); SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_select], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_select].clip); break; case MENU_GAMEOVER.REVIVE_SHARDS: if (PlayerStatus.RemainReviveCount > 0) { Vibration.Vibrate(100); PlayerStatus.CurrentMemoryShards -= TopMostControl.Instance().GetRequiredShardsForRevive(); PlayerStatus.CurrentHP = PlayerStatus.MaxHP; PlayerStatus.RemainReviveCount -= 1; TopMostControl.Instance().StartGlobalLightEffect(Color.yellow, 2f, 0.2f); TopMostControl.Instance().GameOver(false); if (cameraController != null) { cameraController.CameraShake_Rot(3); } EffectManager.GetInstance().playEffect(playerController.GetPlayerRigidBody().transform.position, EFFECT.YELLOW_PILLAR, Vector2.zero); TopMostControl.Instance().StartBGM(SceneManager.GetActiveScene()); SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_revive], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_revive].clip); Firebase.Analytics.FirebaseAnalytics.LogEvent(GameStatics.EVENT_REVIVE_SHARD); } break; case MENU_GAMEOVER.REVIVE_AD: GameManager.Instance().ShowReviveAds(); break; default: break; } }
public void SetUpgradeStatus() { if (GameConfigs.SkillLevel(this.skillType) >= GameConfigs.MAXSkillLevel(this.skillType)) { level.text = "LV.MAX"; Color tColor = cost.color; tColor.a = 0.4f; cost.color = tColor; upgradeStatus = GameStatics.UPGRADE_STATUS.MAX_LEVEL; switch (this.skillType) { case GameStatics.SKILL_TYPE.MAXHP: expect.text = PlayerManager.Instance().PlayerStatus.MaxHP.ToString(); break; case GameStatics.SKILL_TYPE.AIRTIME_DURATION: expect.text = PlayerManager.Instance().PlayerStatus.AirTimeDuration.ToString(); break; case GameStatics.SKILL_TYPE.SHARD_PULL_DIST: expect.text = GameStatics.GetShardPullDistance().ToString(); break; default: break; } } else if (GameStatics.GetRequiredShardsForUpgrade(skillType) > PlayerManager.Instance().PlayerStatus.CurrentMemoryShards) { // 조각 부족 Color tColor = cost.color; tColor.a = 0.4f; cost.color = tColor; upgradeStatus = GameStatics.UPGRADE_STATUS.NOT_ENOUGH_SHARD; } else { // 업그레이드 가능 Color tColor = cost.color; tColor.a = 1f; cost.color = tColor; upgradeStatus = GameStatics.UPGRADE_STATUS.POSSIBLE; } }
public void StartChangeScene(SCENE_INDEX targetSceneIndex, bool smoothChange, int nextStageNum = 1) { topCanvas.sortingOrder = 10; isChangingState = true; blackPanelAlpha.startValue = 0f; blackPanelAlpha.endValue = 1f; currentTargetScene = targetSceneIndex; blackPanelAlpha.TweenCompleted += SceneFadeoutFinishEvent; blackPanelAlpha.Begin(); blackPanelAlpha.value = blackPanelAlpha.startValue; StageLoader.NextStage = nextStageNum; GameConfigs.SetPlayTime(TopMostControl.Instance().playUnixTime); }
public void OnClickSettingShow() { bool possibleSettingShow = false; if (SceneManager.GetActiveScene().buildIndex == (int)SCENE_INDEX.MAINMENU) { possibleSettingShow = true; } else if ((SceneManager.GetActiveScene().buildIndex == (int)SCENE_INDEX.GAMESTAGE) && PlayerManager.Instance().GetPlayerControl().IsGround()) { possibleSettingShow = true; } if (possibleSettingShow) { topCanvas.sortingOrder = 10; SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_select], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_select].clip); IsSettingState = true; SettingControlTweenTrans.gameObject.SetActive(true); SettingControlTweenTrans.startingVector = outXPos_SettingControl; SettingControlTweenTrans.endVector = inXPos_SettingControl; if (SceneManager.GetActiveScene().buildIndex == (int)SCENE_INDEX.MAINMENU) { SettingGoBackText.text = "Exit Game"; } else { SettingGoBackText.text = "Main Menu"; } SettingControlTweenTrans.Begin(); SettingControlTweenTrans.defaultVector = SettingControlTweenTrans.startingVector; if (slider_bgm != null && slider_sfx != null) { slider_bgm.SetValueWithoutNotify(SoundManager.MusicVolume); slider_sfx.SetValueWithoutNotify(SoundManager.SoundVolume); } if (toggle_vibrate != null) { toggle_vibrate.SetIsOnWithoutNotify(GameConfigs.GetIsVibrate()); } } }
void ShowOptionPlayTimer() { if (GameManager.Instance().IsGameInitialize) { if (SceneManager.GetActiveScene().buildIndex == (int)SCENE_INDEX.GAMESTAGE) { TimeSpan diff = DateTime.UtcNow - GameManager.Instance().Time_LatestStartGame; playUnixTime = GameConfigs.GetPlayUnixTime() + (int)diff.TotalSeconds; } else { playUnixTime = GameConfigs.GetPlayUnixTime(); } TimeSpan curPlayTimeSpan = TimeSpan.FromSeconds(playUnixTime); playTimeText.text = string.Format("{0}:{1}:{2}", curPlayTimeSpan.Hours, curPlayTimeSpan.Minutes.ToString("D2"), curPlayTimeSpan.Seconds.ToString("D2")); } }
void OnClickUpgradeButton(SKILL_TYPE skillType) { // Upgrade Possible if ((GetRequiredShardsForUpgrade(skillType) <= PlayerManager.Instance().PlayerStatus.CurrentMemoryShards) && (currentGameUIStatus == TOPUI_STATUS.GAMEOVER)) { int requiredShards = GetRequiredShardsForUpgrade(skillType); PlayerManager.Instance().PlayerStatus.CurrentMemoryShards -= requiredShards; GameConfigs.SetCurrentMemoryShards(PlayerManager.Instance().PlayerStatus.CurrentMemoryShards); GameConfigs.SetSkillLevel(skillType, GameConfigs.SkillLevel(skillType) + 1); foreach (UpgradeElement element in upgradeElements) { element.SetInfo(); } int effectShardAmount = (GameConfigs.SkillLevel(skillType) / 3) + 1; if (effectShardAmount < 1) { effectShardAmount = 1; } if (effectShardAmount > 10) { effectShardAmount = 10; } StageLoader.Instance().Generate_SkillUpgradeEffectShards(skillType, effectShardAmount); Vibration.Vibrate(3); StartGlobalLightEffect(Color.white, 1f, 0.2f); SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_powerUp], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_powerUp].clip); if (onCameraShake != null) { onCameraShake(2); } } }
public void OnEnable() { if (moveTrigger == GameStatics.MOVE_TRIGGER.MOVE_NEXTSTAGE) { FromPortalOff.SetActive(false); FromPortalOn.SetActive(false); ToPortalOff.SetActive(false); ToPortalOn.SetActive(false); FromPortalEffect.SetActive(false); ToPortalEffect.SetActive(false); TriggerOn = true; } else if (moveTrigger == GameStatics.MOVE_TRIGGER.MOVE_POSITION) { bool isOnPortal = GameConfigs.PortalStatus(portalType); SetPortal(isOnPortal); } }
public AGameObject(Rectangle region, SpriteName spriteName, GameMatrix parent, AGameObject left = null, AGameObject right = null, AGameObject top = null, AGameObject bottom = null) { Region = region; this.Parent = parent; NewPosition = new Point(region.X, region.Y); SpriteName = spriteName; Left = left; Right = right; Top = top; Bottom = bottom; Visible = true; if (Left != null) { Left.Right = this; } if (Right != null) { Right.Left = this; } if (Top != null) { Top.Bottom = this; } if (Bottom != null) { Bottom.Top = this; } AnimationState = SpriteAnimationState.SHOW; SpriteAnimationStep = 8; gFactory = GameObjectFactory.GetInstance(); gc = GameConfigs.GetInstance(); }
public void OnClickPortalPurchase() { if (currentSelectedPortalTrigger != null) { if (GameStatics.GetPortalOpenCost(currentSelectedPortalTrigger.portalType) <= PlayerManager.Instance().PlayerStatus.CurrentMemoryShards) { // Open the portal PlayerManager.Instance().PlayerStatus.CurrentMemoryShards -= GameStatics.GetPortalOpenCost(currentSelectedPortalTrigger.portalType); GameConfigs.SetPortalStatus(currentSelectedPortalTrigger.portalType, true); GameConfigs.SetCurrentMemoryShards(PlayerManager.Instance().PlayerStatus.CurrentMemoryShards); currentSelectedPortalTrigger.SetPortal(true); StartGlobalLightEffect(Color.magenta, 4f, 0.6f); SoundManager.PlayOneShotSound(SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_powerUp], SoundContainer.Instance().SoundEffectsDic[GameStatics.sound_powerUp].clip); if (onCameraShake != null) { onCameraShake(7); } } } }
public void InitializationPools(GameConfigs settings, bool isMultiplayer) { multiplayer = isMultiplayer; var poolsConfig = settings.Pool["sample"]; var deathConfig = settings.Image["death"]; var splahesConfig = settings.Image["stones_fragment"]; var stonesConfig = settings.Weapon["stone"]; //var axesConfig = settings.Weapon["axe"]; //var skullsConfig = settings.Weapon["skulls"]; var bonusSpeedConfig = settings.Bonus["speed"]; var swordConfig = settings.Weapon["sword"]; ImagesDeath = PreparePool(containerImagesDeath, Inst <ImageBase>(deathConfig.PrefabPath), poolsConfig.ImagesOrdinary, null); SplashesStone = PreparePool(containerSplashStones, Inst <ImageBase>(splahesConfig.PrefabPath), poolsConfig.ImagesPopular, null); //Skulls = PreparePool(containerSkulls, Inst<WeaponModelBase>(skullsConfig.PrefabPath), poolsConfig.WeaponsOrdinary, InitializationPoolAxe, isMultiplayer); Stones = PreparePool(containerStones, Inst <WeaponModelBase>(stonesConfig.PrefabPath), poolsConfig.WeaponsPopular, InitializationPoolStone); //Axes = PreparePool(Inst<WeaponModelBase>(axesConfig.PrefabPath), poolsConfig.BonusesOrdinary); BonusesSpeed = PreparePool(containerBonusesSpeed, Inst <BonusBase>(bonusSpeedConfig.PrefabPath), poolsConfig.BonusesOrdinary, InitializationPoolBonus); print("start pool sword"); Sword = PreparePool(containerSword, Inst <WeaponModelBase>(swordConfig.PrefabPath), poolsConfig.WeaponsRare, InitializationPoolSword); print(Sword); Stones.RelatedPool += () => SplashesStone; // for map Pools.Add(stonesConfig.PrefabPath, Stones); //Pools.Add(axesConfig.PrefabPath, Axes); Pools.Add(bonusSpeedConfig.PrefabPath, BonusesSpeed); Pools.Add(swordConfig.PrefabPath, Sword); }