Beispiel #1
0
        /// <summary>
        /// Initializes sound files.
        /// </summary>
        public static void Initialize(IGameConfig config)
        {
            int id = 0;

            Clear1      = new SoundSample(++id, Path.Combine(config.AudioSampleFolder, "Clear1.mp3"));
            Clear2      = new SoundSample(++id, Path.Combine(config.AudioSampleFolder, "Clear2.mp3"));
            Click1      = new SoundSample(++id, Path.Combine(config.AudioSampleFolder, "Click1.mp3"));
            Click2      = new SoundSample(++id, Path.Combine(config.AudioSampleFolder, "Click2.mp3"));
            Click3      = new SoundSample(++id, Path.Combine(config.AudioSampleFolder, "Click3.mp3"));
            Error1      = new SoundSample(++id, Path.Combine(config.AudioSampleFolder, "Error1.mp3"));
            Explode1    = new SoundSample(++id, Path.Combine(config.AudioSampleFolder, "Explode1.mp3"));
            Explode2    = new SoundSample(++id, Path.Combine(config.AudioSampleFolder, "Explode2.mp3"));
            Explode3    = new SoundSample(++id, Path.Combine(config.AudioSampleFolder, "Explode3.mp3"));
            Hit1        = new SoundSample(++id, Path.Combine(config.AudioSampleFolder, "Hit1.mp3"));
            Hit2        = new SoundSample(++id, Path.Combine(config.AudioSampleFolder, "Hit2.mp3"), 0.8f);
            LevelUp1    = new SoundSample(++id, Path.Combine(config.AudioSampleFolder, "LevelUp1.mp3"));
            MenuBack1   = new SoundSample(++id, Path.Combine(config.AudioSampleFolder, "MenuBack1.mp3"));
            MenuMove1   = new SoundSample(++id, Path.Combine(config.AudioSampleFolder, "MenuMove1.mp3"));
            MenuMove2   = new SoundSample(++id, Path.Combine(config.AudioSampleFolder, "MenuMove2.mp3"));
            MenuSelect1 = new SoundSample(++id, Path.Combine(config.AudioSampleFolder, "MenuSelect1.mp3"));
            MenuSelect2 = new SoundSample(++id, Path.Combine(config.AudioSampleFolder, "MenuSelect2.mp3"));
            Music1      = new SoundSample(++id, Path.Combine(config.AudioSampleFolder, "Music1.mp3"), 0.1f, true);
            Music2      = new SoundSample(++id, Path.Combine(config.AudioSampleFolder, "Music2.mp3"), 0.2f, true);
            Send1       = new SoundSample(++id, Path.Combine(config.AudioSampleFolder, "Send1.mp3"));
        }
Beispiel #2
0
 public ShakeSystem(Contexts contexts)
 {
     _contexts   = contexts;
     _config     = _contexts.config.gameConfig.value;
     _shakeGroup = _contexts.game.GetGroup(GameMatcher.AllOf(GameMatcher.Shake, GameMatcher.ShakeDuration,
                                                             GameMatcher.ShakeAmount, GameMatcher.ShakeOriginalPosition));
 }
Beispiel #3
0
        internal GameSelectorEditor(IGameConfig Config, Action <string> SetGame)
        {
            InitializeComponent();
            int CurrentGameNode = 0;

            this.SetGame = SetGame;

            foreach (IGameModel Game in Config.Games)
            {
                int CurrentOptionalNode = 0;
                TreVie_GamesView.Nodes.Add(Game.Name + ":" + Game.GUID);
                TreVie_GamesView.Nodes[CurrentGameNode].Nodes.Add(GUID + Game.GUID);
                TreVie_GamesView.Nodes[CurrentGameNode].Nodes.Add(TheName + Game.Name);
                TreVie_GamesView.Nodes[CurrentGameNode].Nodes.Add(Path + Game.Path);
                TreVie_GamesView.Nodes[CurrentGameNode].Nodes.Add(ImagePath + Game.ImagePath);
                TreVie_GamesView.Nodes[CurrentGameNode].Nodes.Add(PlayTime + Game.PlayTime.ToString());
                TreVie_GamesView.Nodes[CurrentGameNode].Nodes.Add(CostToPlay + Game.CostToPlay.ToString());
                TreVie_GamesView.Nodes[CurrentGameNode].Nodes.Add(StartOptions + Game.StartOptions);
                TreVie_GamesView.Nodes[CurrentGameNode].Nodes.Add(OptionalAdditionalExeStarts);
                foreach (IOptionalAddtionalExeStartsModel OptionalExe in Game.IOptionalAddtionalExeStarts)
                {
                    TreVie_GamesView.Nodes[CurrentGameNode].Nodes[GameMemoryMap["ExeStarts"]].Nodes.Add(OptionalAdditionalExeStartsIndividual + CurrentOptionalNode);
                    TreVie_GamesView.Nodes[CurrentGameNode].Nodes[GameMemoryMap["ExeStarts"]].Nodes[CurrentOptionalNode].Nodes.Add(Path + OptionalExe.Path);
                    TreVie_GamesView.Nodes[CurrentGameNode].Nodes[GameMemoryMap["ExeStarts"]].Nodes[CurrentOptionalNode].Nodes.Add(Delay + OptionalExe.Delay.ToString());
                    TreVie_GamesView.Nodes[CurrentGameNode].Nodes[GameMemoryMap["ExeStarts"]].Nodes[CurrentOptionalNode].Nodes.Add(StartOptions + OptionalExe.StartOptions);

                    CurrentOptionalNode++;
                }
                TreVie_GamesView.ExpandAll();
                CurrentGameNode++;
            }
        }
    private IEnumerator deleteStarPerform(int starNum, int totalScore, int preScore, int curScore, StarSettlementView settlementView)
    {
        for (int i = starNum - 1; i >= 0; i--)
        {
            GameObject starObject = gameObject.transform.GetChild(i).gameObject;
            starObject.SetActive(false);
            totalScore = totalScore - preScore;
            totalScore = totalScore >= 0 ? totalScore : 0;
            //播放消失动画

            settlementView.UpdateScore(totalScore);
            if (totalScore > 0)
            {
                yield return(new WaitForSeconds(0.5f));
            }
        }
        UIManager.Instance.CloseView(settlementView.GetViewID());

        //更新当前分数
        EventManager.Instance.EventDispatcher.dispatchEvent <int, float, float>(EventEnum.FightUI_Update_LevelInfo, -1, -1, curScore);
        ChangeLevelView changeLevelView = UIManager.Instance.ShowView <ChangeLevelView>(UIType.Fight_ChangeLevelView);

        if (changeLevelView)
        {
            LevelInfoComponent levelInfo  = _context.levelInfo;
            IGameConfig        gameConfig = _context.gameConfig.config;
            if (levelInfo != null && gameConfig != null)
            {
                changeLevelView.Show(levelInfo.curScore >= levelInfo.targetScore, levelInfo.curLevelId >= gameConfig.GetLevelTotalNum());
            }
        }
    }
Beispiel #5
0
 public EntityViewBehaviourInitializer(ISceneContext sceneContext, GameContext context, IGameConfig gameConfig, IOsnowaContextManager contextManager)
 {
     _sceneContext   = sceneContext;
     _context        = context;
     _gameConfig     = gameConfig;
     _contextManager = contextManager;
 }
Beispiel #6
0
 public void Init(IActorController actorController, IActorInitializer actorInitializer, IUiConfig uiConfig, IGameConfig gameConfig)
 {
     _actorController  = actorController;
     _actorInitializer = actorInitializer;
     _uiConfig         = uiConfig;
     _gameConfig       = gameConfig;
 }
Beispiel #7
0
        private static void LaunchParty(IGameConfig gameConfig)
        {
            var game = CreateGame(gameConfig);

            game.Start();
            RemoveGameSubscriptions(game);
        }
 public ResolveAbilitiesPerTurnSystem(GameContext context, IEntityDetector entityDetector, IUiFacade uiFacade, IGameConfig gameConfig)
     : base(context)
 {
     _context        = context;
     _entityDetector = entityDetector;
     _uiFacade       = uiFacade;
     _gameConfig     = gameConfig;
 }
Beispiel #9
0
    public void ReplaceGameConfig(IGameConfig newValue)
    {
        var index     = ConfigComponentsLookup.GameConfig;
        var component = (GameConfigComponent)CreateComponent(index, typeof(GameConfigComponent));

        component.value = newValue;
        ReplaceComponent(index, component);
    }
Beispiel #10
0
 public SoundPlayer(IGameConfig gameConfig, IRandomNumberGenerator rng, GameContext context,
                    IUnityGridInfoProvider unityGridInfoProvider)
 {
     _gameConfig            = gameConfig;
     _rng                   = rng;
     _context               = context;
     _unityGridInfoProvider = unityGridInfoProvider;
 }
Beispiel #11
0
 public void Init(IGameConfig gameConfig)
 {
     if (_gameConfig != null)
     {
         throw new InvalidOperationException("GameConfig has already been initialized");
     }
     _gameConfig = gameConfig;
 }
Beispiel #12
0
        private static GameRoom CreateRoom(IGameConfig config)
        {
            GameRoom room = new GameRoom(config);

            m_rooms.Add(config.Name, room);
            Logger.WriteLine("Game++");
            return(room);
        }
Beispiel #13
0
 public static GameRoom CreateOrGetGame(IGameConfig config)
 {
     if (m_rooms.ContainsKey(config.Name))
     {
         return(m_rooms[config.Name]);
     }
     return(CreateRoom(config));
 }
Beispiel #14
0
 public ShoutWarningAction(GameEntity entity, float energyCost, IBroadcastStimulusSender broadcastStimulusSender,
                           IGameConfig gameConfig, IPositionEffectPresenter positionEffectPresenter, IActionEffectFactory actionEffectFactory)
     : base(entity, energyCost, actionEffectFactory)
 {
     _broadcastStimulusSender = broadcastStimulusSender;
     _gameConfig = gameConfig;
     _positionEffectPresenter = positionEffectPresenter;
 }
        public IGameConfig PrepareForGame(IGameConfig gameConfig)
        {
            var players     = gameConfig?.Players.ToList() ?? CreatePlayers();
            var firstPlayer = ChooseFirstPlayer(players);
            var boardSize   = GetBoardSize();

            return(_gameConfigFactory.CreateGameConfig(players, firstPlayer, boardSize));
        }
Beispiel #16
0
    //----

    public static void Init(IGameConfig _gameConfig, Func <int, IUnitSDS> _getUnitCallBack, Func <int, ISkillSDS> _getSkillCallBack)
    {
        gameConfig = _gameConfig;

        getUnitCallBack = _getUnitCallBack;

        getSkillCallBack = _getSkillCallBack;
    }
Beispiel #17
0
    public void ReplaceGameConfig(IGameConfig newConfig)
    {
        var index     = GameComponentsLookup.GameConfig;
        var component = (GameConfigComponent)CreateComponent(index, typeof(GameConfigComponent));

        component.config = newConfig;
        ReplaceComponent(index, component);
    }
Beispiel #18
0
        public PresentSurroundingsSystem(IGameConfig gameConfig, IContext <GameEntity> context, ITilePresenter tilePresenter, IVisibilityUpdater visibilityUpdater)
            : base(context)
        {
            _gameConfig = gameConfig;

            _tilePresenter     = tilePresenter;
            _visibilityUpdater = visibilityUpdater;
        }
 public void Init(IGameConfig gameConfig)
 {
     if (_gameConfig != null)
     {
         throw new InvalidOperationException("GameConfig has already been initialized");
     }
     _gameConfig = gameConfig;
 }
Beispiel #20
0
        private static IGame CreateGame(IGameConfig config)
        {
            var game = GameFactory.CreateGame(config);

            game.Finished += OnGameFinished;
            game.StepDone += OnStepDone;

            return(game);
        }
Beispiel #21
0
        public DeathHandler(IUiFacade uiFacade, IViewCreator viewCreator, IGameConfig gameConfig, IPositionEffectPresenter positionEffectPresenter, IOsnowaContextManager contextManager)
        {
            _uiFacade    = uiFacade;
            _viewCreator = viewCreator;
            _gameConfig  = gameConfig;

            _positionEffectPresenter = positionEffectPresenter;
            _contextManager          = contextManager;
        }
Beispiel #22
0
 public StimulusHandler(IGameConfig gameConfig, IActivityResolver activityResolver, ISceneContext sceneContext,
                        IFriendshipResolver friendshipResolver, IActivityInterruptor activityInterruptor)
 {
     _gameConfig          = gameConfig;
     _activityResolver    = activityResolver;
     _sceneContext        = sceneContext;
     _friendshipResolver  = friendshipResolver;
     _activityInterruptor = activityInterruptor;
 }
        /// <summary>
        /// Builds an instancer with the kernel32's event catch
        /// </summary>
        public GameInstancer(IGameConfig Config, bool AddCloseEvent = false)
        {
            this.Config = Config;

            if (Config == null)
            {
                throw new Exception("Not a valid config. Please set to a valid IGameConfig Interface.");
            }
        }
Beispiel #24
0
 public DropAction(GameEntity entity, float energyCost, GameEntity itemToDrop, IActionEffectFactory actionEffectFactory, IFirstPlaceInAreaFinder firstPlaceInAreaFinder, IEntityDetector entityDetector, IGameConfig gameConfig, IUiFacade uiFacade, IPositionEffectPresenter positionEffectPresenter)
     : base(entity, energyCost, actionEffectFactory)
 {
     _itemToDrop             = itemToDrop;
     _firstPlaceInAreaFinder = firstPlaceInAreaFinder;
     _entityDetector         = entityDetector;
     _gameConfig             = gameConfig;
     _uiFacade = uiFacade;
     _positionEffectPresenter = positionEffectPresenter;
 }
Beispiel #25
0
        public TileMatrixUpdater(IPositionFlagsResolver positionFlagsResolver, IGameConfig gameConfig,
                                 ITileByIdProvider tileByIdProvider, ISceneContext sceneContext, IOsnowaContextManager contextManager)
        {
            _positionFlagsResolver = positionFlagsResolver;
            _gameConfig            = gameConfig;
            _tileByIdProvider      = tileByIdProvider;
            _sceneContext          = sceneContext;

            contextManager.ContextReplaced += newContext => _tileMatricesByteByLayer = newContext.TileMatricesByLayer;
        }
Beispiel #26
0
        public void ShowStats(IGameConfig gameConfig)
        {
            Console.Clear();
            ShowHeader();

            var stats = "Player: " + gameConfig.Player.Name + "(Win: " + gameConfig.Player.Wins + ")" +
                        "\t Computer: " + gameConfig.Computer.Name + "(win: " + gameConfig.Computer.Wins + ")";

            Console.WriteLine(stats);
        }
Beispiel #27
0
 public DeathHandler(IGameConfig gameConfig, IUiConfig uiConfig, IEntityRemover entityRemover, IEntitySpawner entitySpawner,
                     IRandomNumberGenerator rng, IGameContext gameContext)
 {
     _gameConfig    = gameConfig;
     _uiConfig      = uiConfig;
     _entityRemover = entityRemover;
     _entitySpawner = entitySpawner;
     _rng           = rng;
     _gameContext   = gameContext;
 }
Beispiel #28
0
 public AttackAction(GameEntity entity, float energyCost, IActionEffectFactory actionEffectFactory, IRandomNumberGenerator rng, GameEntity attackedEntity, IGameConfig gameConfig, IAggressionTriggerer aggressionTriggerer, IPositionEffectPresenter positionEffectPresenter, IOsnowaContextManager contextManager, ReactiveFeature reactiveFeature)
     : base(entity, energyCost, actionEffectFactory)
 {
     AttackedEntity       = attackedEntity;
     _rng                 = rng;
     _actionEffectFactory = actionEffectFactory;
     _gameConfig          = gameConfig;
     _contextManager      = contextManager;
     _reactiveFeature     = reactiveFeature;
 }
Beispiel #29
0
 public EntitySpawner(ItemBehaviour.Factory itemBehaviourFactory, ActorBehaviour.Factory actorBehaviourFactory,
                      IGameContext gameContext, IGameConfig gameConfig, IRandomNumberGenerator rng, IEntityDetector entityDetector, IGridInfoProvider gridInfoProvider)
 {
     _itemBehaviourFactory  = itemBehaviourFactory;
     _actorBehaviourFactory = actorBehaviourFactory;
     _gameContext           = gameContext;
     _gameConfig            = gameConfig;
     _rng              = rng;
     _entityDetector   = entityDetector;
     _gridInfoProvider = gridInfoProvider;
 }
Beispiel #30
0
 public void Init(IUnityGridInfoProvider unityGridInfoProvider, IUiFacade uiFacade, IOsnowaContextManager contextManager,
                  ITileByIdProvider tileByIdProvider, IGameConfig gameConfig, IEntityDetector entityDetector, GameContext context)
 {
     _tileByIdProvider      = tileByIdProvider;
     _contextManager        = contextManager;
     _uiFacade              = uiFacade;
     _unityGridInfoProvider = unityGridInfoProvider;
     _gameConfig            = gameConfig;
     _entityDetector        = entityDetector;
     _context = context;
 }
Beispiel #31
0
        public TilePresenter(ISceneContext sceneContext, IGameConfig gameConfig, IOsnowaContextManager contextManager,
                             ITileByIdProvider tileByIdProvider, ITileMatrixUpdater tileMatrixUpdater)
        {
            _gameConfig        = gameConfig;
            _sceneContext      = sceneContext;
            _contextManager    = contextManager;
            _tileByIdProvider  = tileByIdProvider;
            _tileMatrixUpdater = tileMatrixUpdater;

            _positionsToReset = new List <Position>(400);
        }
Beispiel #32
0
        public void Init()
        {
            config = new GameConfigImpl();

            string contextPath;
            if (!config.TryGetStringConfig(StringConfigEnum.ContentPath, out contextPath))
            {
                return;
            }

            cardLibrary = new CardLibraryImpl(contextPath + "/Data/card.json");

            var c = new CraftImpl();
            c.Init(this);
            craft = c;

            var raf = new RaffleImpl();
            raf.Init(this);
            raffle = raf;
        }
Beispiel #33
0
 public Game(GameRoom room, IGameConfig config)
 {
     Config = config;
     State = GameState.Lobby;
     IsMatch = config.Mode == 1;
     IsTag = config.Mode == 2;
     CurrentPlayer = 0;
     LifePoints = new int[2];
     Players = new Player[IsTag ? 4 : 2];
     CurPlayers = new Player[2];
     IsReady = new bool[IsTag ? 4 : 2];
     m_handResult = new int[2];
     m_timelimit = new int[2];
     m_bonustime = new int[2];
     m_matchResult = new int[6];
     Observers = new List<Player>();
     if (config.LfList >= 0 && config.LfList < BanlistManager.Banlists.Count)
         Banlist = BanlistManager.Banlists[config.LfList];
     m_room = room;
     m_analyser = new GameAnalyser(this);
 }
Beispiel #34
0
        public Game(IGameConfig config, GameDisplay display)
        {
            if (display == null)
            {
                State = GameStateWrongDisplay;
                return;
            }

            _display = display;

            if (config == null || !config.IsGoodConfig())
            {
                State = GameStateWrongConfig;
                return;
            }

            _world = new World(config.GetDimension());
            _world.SetLiveCells(config.GetLiveCells());
            _display.SetWorld(_world);
        }