public override void Play(GameView view, Action<object[]> onComplete, params object[] args)
        {
            var columns = args[0] as List<List<Animal>>;
            if (columns == null)
                return;

            var longestDuration = TimeSpan.Zero;
            foreach (var column in columns)
            {
                for (var index = 0; index < column.Count; index++)
                {
                    var animal = column[index];

                    view.DropAnimal(animal, column[0].Y - 1);
                    var duration = TimeSpan.FromSeconds((animal.Y - (column[0].Y - 1)) * 0.1F);

                    if (duration + TimeSpan.FromSeconds(0.1F + (0.2F * (column.Count - index - 1))) > longestDuration)
                        longestDuration = duration + TimeSpan.FromSeconds(0.1F + (0.2F * (column.Count - index - 1)));

                    animal.Sprite.AddActivity(new ActivitySequence(new Activity[]
                    {
                        new WaitActivity(TimeSpan.FromSeconds(0.1F + (0.2F * (column.Count - index - 1)))),
                        new ActivityGroup(new Activity[]
                        {
                            new FadeActivity(FadeActivity.Fade.In, TimeSpan.FromSeconds(0.05F), EaseMode.InOut),
                            new MoveActivity(new Vector2((animal.X * view.TileSize.X) + (view.TileSize.X / 2),
                                (animal.Y * view.TileSize.Y) + (view.TileSize.Y / 2)), duration, EaseMode.Out)
                        })
                    }));
                }
            }

            view.AddActivity(new WaitActivity(longestDuration, onComplete));
        }
Exemple #2
0
    public virtual IView Create(ViewTypes type)
    {
        IView view = null;
        switch (type) {
            case ViewTypes.GAME:
                view = new GameView(services.Updateables, services.GameService);
            break;
            case ViewTypes.INIT:
                view = new InitView();
            break;
            case ViewTypes.LOAD:
                view = new LoadView();
            break;
            case ViewTypes.MAIN:
                view = new MainView(services);
                break;
            case ViewTypes.RESULTS:
                view = new ResultsView(services);
                break;
            case ViewTypes.LEVEL_UP:
                view = new LevelUpView(services);
                break;
        }
        initView(view);

        return view;
    }
Exemple #3
0
 /// <summary>
 /// Initialize the board layout from a GameView. It's important to remember that 
 /// the board appears rotated 180 degrees from player 2's perspective, but all 
 /// the slots still face the active player.
 /// </summary>
 /// <param name="gameView"></param>
 public void InitializeFromView(GameView gameView)
 {
     coordinates = gameView.coordinates;
     // First, figure out the maximum dimensions of the board:
     int maxX = 0, maxY = 0;
     foreach(EntityCoordinates coord in gameView.coordinates)
     {
         if (coord.x > maxX) maxX = coord.x;
         if (coord.y > maxY) maxY = coord.y;
     }
     int columns = maxX + 1;
     int rows = maxY + 1;
     unitSlots = new UnitSlot[columns, rows];
     bool reverseView = false;
     if (gameView.viewerPosition == 2) reverseView = true;
     Vector2 center = new Vector2((float) (columns - 1) / 2, (float) (rows - 1) / 2);
     Debug.Log(center);
     foreach(EntityCoordinates coord in gameView.coordinates)
     {
         if (unitSlots[coord.x, coord.y] == null)
         {
             Vector3 pos = GetSlotPosition(coord, center, reverseView);
             UnitSlot slot = CreateSlot(pos, spaceSlotPrototype, spaceSlots);
             slot.x = coord.x;
             slot.y = coord.y;
             unitSlots[coord.x, coord.y] = slot;
         }
     }
     InitializeEntities(gameView);
 }
        public override void Play(GameView view, Action<object[]> onComplete, params object[] args)
        {
            var longestDuration = TimeSpan.Zero;
            var columns = args[0] as List<List<Animal>>;

            if (columns == null)
                return;

            foreach (var column in columns)
            {
                for (var index = 0; index < column.Count; index++)
                {
                    var animal = column[index];

                    var duration = TimeSpan.FromSeconds(((new Vector2(animal.X * view.TileSize.Y + (view.TileSize.Y / 2.0F),
                        animal.Y * view.TileSize.Y + (view.TileSize.Y / 2.0F)).Y - animal.Sprite.LocalPosition.Y) / view.TileSize.Y) * 0.1F);

                    if (duration + TimeSpan.FromSeconds(0.05F + (0.15F * index)) > longestDuration)
                        longestDuration = duration + TimeSpan.FromSeconds(0.05F + (0.15F * index));

                    animal.Sprite.AddActivity(new ActivitySequence(new Activity[]
                    {
                        new WaitActivity(TimeSpan.FromSeconds(0.05F + (0.15F * index))),
                        new MoveActivity(new Vector2(animal.X * view.TileSize.Y + (view.TileSize.Y / 2.0F), animal.Y * view.TileSize.Y + (view.TileSize.Y / 2.0F)), duration, EaseMode.Out)
                    }));
                }
            }

            view.AddActivity(new WaitActivity(longestDuration, onComplete));
        }
Exemple #5
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            camera = new Camera(GraphicsDevice.Viewport);
            gameView = new GameView(spriteBatch, camera, Content.Load<Texture2D>("spark"));
        }
Exemple #6
0
	void Start () {
		a = GetComponent<AStar>();
		view = GetComponent<GameView>();

		a.Init(row, col, startPos, endPos);
		a.PutObstacle(obstaclePos);

		view.ShowMap();
		// view.ShowSearchPath();
	}
Exemple #7
0
 private void ShowGameScreen()
 {
     _gameModel = new GameModel();
     _gameView = new GameView(_gameModel);
     _gameModel.Width = _gameView.Width;
     _gameModel.Height = _gameView.Height;
     _gameModel.Initialize();
     _gameModel.Start();
     _page.LayoutRoot.Children.Add(_gameView);
 }
Exemple #8
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            camera = new Camera(GraphicsDevice.Viewport);
            gameView = new GameView(spriteBatch, camera, Content.Load<Texture2D>("explosion")); // load the image

            // TODO: use this.Content to load your game content here
        }
        public override void Play(GameView view, Action<object[]> onComplete, params object[] args)
        {
            var swap = args[0] as Swap;

            if (swap == null)
                return;

            swap.From.Sprite.AddActivity(new MoveActivity(swap.From.Sprite.LocalPosition, swap.To.Sprite.LocalPosition, TimeSpan.FromSeconds(0.33D), EaseMode.Out));
            swap.To.Sprite.AddActivity(new MoveActivity(swap.To.Sprite.LocalPosition, swap.From.Sprite.LocalPosition, TimeSpan.FromSeconds(0.33D), EaseMode.Out, onComplete));
        }
		public void Initialize(GameView game, Entity entity)
		{
			this.game = game;
			this.Entity = entity;

			name = entity.GetType().Name;
			transform.localPosition = ToUnityVector3(entity.Position);

			entity.Moved += OnMoved;
			entity.Destroyed += OnDestroyed;
		}
 private void btnGame_Click(object sender, RoutedEventArgs e)
 {
     if (Init())
     {
         GameDialog = new GameDialog();
         GameDialog.Parent = this;
         GameView child = new GameView();
         child.gp = this.gp;
         child.Close += new EventHandler(child_Close);
         GameDialog.Content = child;
         GameDialog.Show();
     }
 }
Exemple #12
0
        public override void Play(GameView view, Action<object[]> onComplete, params object[] args)
        {
            var swap = args[0] as Swap;

            if (swap == null)
                return;

            var moveTo = new MoveActivity(swap.From.Sprite.LocalPosition, swap.To.Sprite.LocalPosition, TimeSpan.FromSeconds(0.2D), EaseMode.Out);
            var moveFrom = new MoveActivity(swap.To.Sprite.LocalPosition, swap.From.Sprite.LocalPosition, TimeSpan.FromSeconds(0.2D), EaseMode.Out);

            swap.From.Sprite.AddActivity(new ActivitySequence(new Activity[] { moveTo, moveFrom }));
            swap.To.Sprite.AddActivity(new ActivitySequence(new[] { moveFrom.Clone(), moveTo.Clone() }, onComplete));
        }
    public PlayGameState( GameStateMachine stateMachine )
        : base(stateMachine)
    {
        foreach( UIView v in UIManager.Instance.Views )
        {
            if( v is GameView )
            {
                view = v as GameView;
            }
        }

        playerStateMachine = GameObject.FindObjectOfType<PlayerStateMachine>() as PlayerStateMachine;
        environmentStateMachine = GameObject.FindObjectOfType<EnvironmentStateMachine>() as EnvironmentStateMachine;
    }
Exemple #14
0
        /// <summary>
        /// Creates a new GameWindow from the given Game.
        /// </summary>
        /// <param name="builder"></param>
        public GameWindow(Game game)
        {
            _game = game;
            _game.GameIsOver += GameIsOver;

            _gameView = new GameView(_game);

            InitializeComponent();
            InitializeGameControl();
            InitializeDataContexts();
            InitializeClock();
            InitializeLastSelectedCases();
            ResetUIState();
        }
    public void SetupGameView(GameView gameView)
    {
        LoadPlayer();

        this.gameView = gameView;
        player = new PlayerModel();
        InputManager.instance.onClickListener += OnClick;

        camObject = GameObject.Find(ElementType.MainCamera.ToString());


        if (anim == null)
        {
            anim = playerObject.GetComponent<Animation>();
        }
    }
	void Start() {
		Countries = new string[]{"England", "Italy", "Germany", "France", "Austria", "Ireland", "China", "Russia", "Japan", "South Korea", "Australia", "Mexico", "Canada", "Brazil", "Israel", "Iraq", "Iran", "Egypt", "South Africa", "Greece", "Spain", "Argentina", "Thailand", "Vietnam", "Ukraine", "Turkey", "New Zealand", "Sweden", "Switzerland", "Chile", "Cuba", "Vatican City", "Finland", "Norway", "India", "Denmark", "Scotland", "Greenland", "Iceland", "Madagascar", "United Arab Emirates", "Afghanistan", "Poland", "Czech Republic", "Slovakia", "Singapore", "Philippines", "Jamaica", "Saudi Arabia", "Taiwan", "Nigeria", "Morocco", "Syria", "Kenya"};
		approval.value = -25;
		StressLevels.value = 50;
		
		folderTopics ();
		List<string> topics = new List<string>();
		if (db = null) {
			db = GameObject.Find ("Google2uDatabase");
			db1 = db.GetComponent<Google2u.Questions>();
		}
		HashSet<string> temptopics = new HashSet<string>();
		questions = new Dictionary<string, List<Question>>();
		gameView = GetComponent<GameView>();
		if (tutorial.tutorial_active) {
			List<Question> y = new List<Question>();
			Question temporary = new Question("This is a freebie, go ahead and click any of the answers.", "Tutorial", 10, 10, 10);
			y.Add(temporary);
			temptopics.Add(temporary.topic);
			questions.Add(temporary.topic, y);
		}
		//Places questions into their respective topics.
		for(int i = 0; i < 33; i++) {
			
			List<Question> y;
			Google2u.QuestionsRow a = db1.Rows [i];
			
			questions.TryGetValue(a._Type, out y);
			
			if(y == null) {
				y = new List<Question>();
			}
			
			Question temporary = new Question(a._Name, a._Type, a._Yes, a._No, a._Maybe);
			y.Add(temporary);
			
			temptopics.Add(temporary.topic); //adding to List for future iteration.
			topics = temptopics.ToList();
			
			
			if(questions.ContainsKey(temporary.topic)) {
				questions.Remove(temporary.topic);
			}
			questions.Add(temporary.topic, y);
		}
	}
Exemple #17
0
 /// <summary>
 /// Remove existing objects and add cards based on the information in the GameView
 /// </summary>
 /// <param name="view"></param>
 public void InitializeFromView(GameView view, int myPosition)
 {
     PlayerView myPlayer = view.players[myPosition - 1];
     List<CardEntity> cardEntities = new List<CardEntity>();
     foreach(EntityView cardView in myPlayer.hand)
     {
         GameObject go = GameManager.Instance.SpawnCard("Default Card", cardView);
         go.name = cardView.name;
         CardEntity ce = go.GetComponent<CardEntity>();
         if(ce == null)
         {
             Debug.LogError("Card prefab did not have CardEntity component");
         }
         cardEntities.Add(ce);   
     }
     SetCards(cardEntities);
 }
Exemple #18
0
        public override void Play(GameView view, Action<object[]> onComplete, params object[] args)
        {
            var chains = args[0] as List<Chain>;

            if (chains == null)
                return;

            foreach (var animal in chains.SelectMany(chain => chain.Animals))
            {
                animal.Sprite?.AddActivity(new ScaleActivity(animal.Sprite.Scale, 0.01F, TimeSpan.FromSeconds(0.33F), EaseMode.Out, e =>
                {
                    animal.Sprite?.Detach();
                    animal.SetSprite(null);
                }));
            }

            view.AddActivity(new WaitActivity(TimeSpan.FromSeconds(0.33F), onComplete));
        }
		private void InitializeUserInterface ()
		{
			MainGame = new GameView();

			var viewModel = new GameViewModel(Network);

			viewModel.PlayCommand = new Command(() =>
				{
					viewModel.Play();

					var winner = viewModel.Winner;
					if (winner != null)
					{
						MainGame.Reveal(winner);
					}
				});
					
			MainGame.ViewModel = viewModel;
			Detail = new NavigationPage(new ContentPage { Title = MainGame.ViewModel.Title, Content = MainGame});
		}
Exemple #20
0
 public ActionResult GridData()
 {
     Func<Game, ICollection<Game>, GameView> getGameView = null;
     getGameView = (org, source) =>
     {
         GameView view = new GameView(org);
         List<Game> children = source.Where(m => m.TreePathIds.Length == org.TreePathIds.Length + 1
             && m.TreePath.StartsWith(org.TreePath)).ToList();
         foreach (Game child in children)
         {
             GameView childView = getGameView(child, source);
             view.children.Add(childView);
         }
         return view;
     };
     List<Game> roots = IGameContract.Games.Where(m => m.Parent == null).OrderBy(m => m.SortCode).ToList();
     List<GameView> datas = (from root in roots
                             let source = IGameContract.Games.Where(m => m.TreePath.StartsWith(root.TreePath)).ToList()
                             select getGameView(root, source)).ToList();
     return Json(datas, JsonRequestBehavior.AllowGet);
 }
        public GameController()
        {
            ViewModel = new GameViewModel(this);
            PokerGameObject = new Poker.PokerGame.Poker(new StaticBlindsController(10));
            View = new GameView() { DataContext = ViewModel };
            PokerGameObject.OnChange(UpdateUI);

            token = tokenSource.Token;

            var task = Task.Factory.StartNew(() =>
            {
                PokerGameObject.AddPlayer(new Player(this, new Wallet(1000)) {Name = "Benas1"});
                PokerGameObject.AddPlayer(new Player(this, new Wallet(1000)) {Name = "Benas2"});
                PokerGameObject.AddPlayer(new Player(this, new Wallet(1000)) {Name = "Benas3"});
                PokerGameObject.AddPlayer(new Player(this, new Wallet(1000)) {Name = "Benas4"});
                PokerGameObject.AddPlayer(new Player(this, new Wallet(1000)) {Name = "Benas5"});
                PokerGameObject.AddPlayer(new Player(this, new Wallet(1000)) {Name = "Benas6"});
                PokerGameObject.AddPlayer(new Player(this, new Wallet(1000)) {Name = "Benas7"});
                PokerGameObject.AddPlayer(new Player(this, new Wallet(1000)) {Name = "Benas8"});
                PokerGameObject.Start(() => token.IsCancellationRequested);
            }, token);

            View.Closed += (sender, args) => tokenSource.Cancel();
        }
Exemple #22
0
    // Use this for initialization
    void Start()
    {
        //すべてクリアする。
        NovelSingleton.clearSingleton();
        StatusManager.initScene();

        Debug.Log("GameStart");

        //ドキュメント作製用
        //DocGenerator.start ();
        //return;

        //NovelSingleton.clearSingleton ();

        this.gameManager = NovelSingleton.GameManager;
        this.gameView    = NovelSingleton.GameView;

        this.gameManager.setScene(this);

        //シナリオの読み込み
        this.gameManager.loadConfig(loadConfigName);

        //font タグを使って指定だな。
        //メッセージフォントカラー設定
        Color c = ColorX.HexToRGB(this.gameManager.getConfig("messageFontColor"));

        c.a = 0f;
        this.gameView.messageArea.GetComponent <Text> ().color    = c;
        this.gameView.messageArea.GetComponent <Text> ().fontSize = int.Parse(this.gameManager.getConfig("messageFontSize"));


        //グローバルコンフィグ読み込み
        this.gameManager.saveManager.loadGlobal();

        if (StatusManager.nextLoad != "")
        {
            string next_load = StatusManager.nextLoad;

            //ロードの場合、画面を再現する必要がある。
            StatusManager.nextLoad = "";

            this.gameManager.loadData(next_load);
        }
        else if (StatusManager.nextFileName != "")
        {
            //scene new でジャンプしてきた後。variable は引き継がないとだめ。
            string file   = StatusManager.nextFileName;
            string target = StatusManager.nextTargetName;

            StatusManager.nextFileName   = "";
            StatusManager.nextTargetName = "";

            //この2つを元にその位置へジャンプした上で実行
            string tag_str = "[jump file='" + file + "' target='" + target + "' ]";

            //タグを実行
            AbstractComponent cmp = this.gameManager.parser.makeTag(tag_str);
            cmp.start();
        }
        else
        {
            //初回起動時
            this.messageSpeed = float.Parse(this.gameManager.getConfig("messageSpeed"));

            StatusManager.variable.replaceAll("global", this.gameManager.globalSetting.globalVar);

            string scenario_file = this.gameManager.getConfig("first_scenario");

            this.gameManager.loadScenario(scenario_file);

            this.gameManager.nextOrder();
        }
    }
Exemple #23
0
 // Use this for initialization
 void Start()
 {
     gameView = GameObject.Find("CPU").GetComponent<GameView>();
     offset = transform.position - target.transform.position;
 }
Exemple #24
0
 public void UpdateCells(List <CellData> cells)
 {
     GameModel.UpdateCells(cells);
     GameView.UpdateViews(cells);
 }
Exemple #25
0
        //Constructors

        public GameController(GameView gV, GameEngine gE)
        {
            _model = gE;
            _view  = gV;
            _view.SetController(this);
        }
 public void init()
 {
     mouseMovementSystem = GameView.get().cameraAndMouseHandler.mouseMovementSystem;
     state.updater       = GameView.get().tileUpdater;
 }
Exemple #27
0
 private void InitializeEntities(GameView gameView)
 {
     foreach(EntityView ev in gameView.inPlay)
     {
         if(ev.OnBoard)
         {
             UnitEntity unit = GameManager.Instance.SpawnUnit(ev);
             PlaceUnit(unit);
         }
     }
 }
Exemple #28
0
        public void Unselect()
        {
            _Highlight.SetActive(false);

            GameView.Unselect();
        }
 public MainWindow()
 {
     InitializeComponent();
     GameView.Focus();
 }
Exemple #30
0
        public static void Initialize(GameView game)
        {
            _game = game;

            ModelHelper.Initialize();
        }
Exemple #31
0
 void Awake()
 {
     gameMod  = new GameModel();
     gameView = GetComponentInChildren <GameView>();
     gameView.init(gameMod);
 }
Exemple #32
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            GameView gameView = new GameView();

            gameView.Show();
        }
Exemple #33
0
 public GameServiceImpl(GameView _gameView, TaskProvider _taskProvider)
 {
     this.gameView     = _gameView;
     this.taskProvider = _taskProvider;
 }
Exemple #34
0
 public SelectView(GameMoudle moudle, GameView view, UIPrefab prefab) : base(moudle, view, prefab)
 {
 }
Exemple #35
0
        private void GamesListBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //Saving the selected game
            savedGame = e;

            List <EntryDTO> listOfEntries;
            //setting up toclistview and entrylistview as observablecollections, so that they can be monitored for changes for autoupdate
            ObservableCollection <TocListView>   tocListView   = new ObservableCollection <TocListView>();
            ObservableCollection <EntryListView> entryListView = new ObservableCollection <EntryListView>();

            GameView selectedGame = (GameView)e.AddedItems[0];

            this.TOCColLabel.Content = selectedGame.Name;
            //Get Tocs on the basis of the game
            //There should be a list with multiple TOCs to choose from, but that will be in another iteration.
            //For now there is only 1 TOC in the DB for each game.

            List <TOCDTO> tocList;
            //Getting the TOCs. ps. only 1 for now
            var parameter = "gameId=" + Convert.ToString(selectedGame.Id);
            var response  = comElements.get("TOC", parameter, "");

            if (response.StatusCode == HttpStatusCode.OK)
            {
                var content = response.Content.ReadAsStringAsync();
                //Deserialize the response
                tocList = JsonConvert.DeserializeObject <List <TOCDTO> >(content.Result);
                //If the list is not empty
                if (tocList.Count != 0)
                {
                    //For now get the first, and only, toc list
                    string parameters = "tocId=" + tocList[0].Id;

                    //Get entries on the basis of the TOC
                    response = comElements.get("Entry", parameters, "");
                    if (response.StatusCode == HttpStatusCode.OK)
                    {
                        //Setting the datasources of the TocListBox and EntryListBox
                        TOCListBox.ItemsSource   = tocListView;
                        EntryListBox.ItemsSource = entryListView;

                        //Getting the list of entries
                        content       = response.Content.ReadAsStringAsync();
                        listOfEntries = JsonConvert.DeserializeObject <List <EntryDTO> >(content.Result);
                        if (listOfEntries.Count != 0)
                        {
                            foreach (EntryDTO entry in listOfEntries)
                            {
                                //Populate the toclistView, datasource for the TOCListBox, with entry.ID, paragraphnumber and headline
                                tocListView.Add(new TocListView()
                                {
                                    Id = entry.Id, ParagraphNumber = entry.ParagraphNumber, Headline = entry.Headline
                                });
                                //Populate the entryListView, datasource for the EntryListBox, with the Entry data.
                                entryListView.Add(new EntryListView()
                                {
                                    Id = entry.Id, ParagraphNumber = entry.ParagraphNumber, Revision = entry.Revision, Headline = entry.Headline, Editor = entry.Editor, Type = entry.Type, Txt = entry.Text
                                });
                            }
                        }
                    }
                    //Setting the variable chosenTocId to the tocList id of the first tocen in the toclist
                    //This makes no sence now, but when it will be able to choosen between multiple toc lists for a game
                    //It will make sence.
                    chosenTocId = tocList[0].Id;
                }
                else
                {
                    //If there is not data clear the listboxes
                    tocListView.Clear();
                    TOCListBox.Items.Clear();
                    entryListView.Clear();
                    EntryListBox.Items.Clear();
                    chosenTocId = 0;
                }
            }
        }
Exemple #36
0
 public void Start()
 {
     gameView = GameObject.Find("CPU").GetComponent<GameView>();
 }
 public GameBullet(GameView inGameView) : base(inGameView)
 {
     _isRun = false;
     SystemFacade.Shooting.AddComponent(this);
 }
Exemple #38
0
	// Use this for initialization
	void Start () {

		//すべてクリアする。
		NovelSingleton.clearSingleton ();
		StatusManager.initScene ();

		Debug.Log("GameStart"); 

		//ドキュメント作製用
		//DocGenerator.start ();
		//return;

		//NovelSingleton.clearSingleton ();

		this.gameManager = NovelSingleton.GameManager;
		this.gameView = NovelSingleton.GameView;

		this.gameManager.setScene (this);

		//シナリオの読み込み
		this.gameManager.loadConfig ();

		//font タグを使って指定だな。
		//メッセージフォントカラー設定
		Color c = ColorX.HexToRGB (this.gameManager.getConfig ("messageFontColor"));
		c.a = 0f;
		this.gameView.messageArea.GetComponent<Text> ().color = c;
		this.gameView.messageArea.GetComponent<Text> ().fontSize = int.Parse(this.gameManager.getConfig ("messageFontSize"));


		//グローバルコンフィグ読み込み
		this.gameManager.saveManager.loadGlobal ();

		if (StatusManager.nextLoad != "") {

			string next_load = StatusManager.nextLoad;

			//ロードの場合、画面を再現する必要がある。
			StatusManager.nextLoad = "";

			this.gameManager.loadData (next_load);


		}else if(StatusManager.nextFileName !=""){

			//scene new でジャンプしてきた後。variable は引き継がないとだめ。
			string file = StatusManager.nextFileName;
			string target = StatusManager.nextTargetName;

			StatusManager.nextFileName = "";
			StatusManager.nextTargetName = "";

			//この2つを元にその位置へジャンプした上で実行
			string tag_str ="[jump file='"+file+"' target='"+ target +"' ]";

			//タグを実行
			AbstractComponent cmp = this.gameManager.parser.makeTag (tag_str);
			cmp.start();



		}else {

			//初回起動時
			this.messageSpeed = float.Parse (this.gameManager.getConfig ("messageSpeed"));

			StatusManager.variable.replaceAll ("global", this.gameManager.globalSetting.globalVar);

			string scenario_file = this.gameManager.getConfig ("first_scenario");

			this.gameManager.loadScenario (scenario_file);

			this.gameManager.nextOrder ();

		}

	}
Exemple #39
0
 public void SetGameView(IGameView[] gameView)
 {
     GameView = gameView[_number++];
     GameView.Select();
 }
Exemple #40
0
 public void ChangeTurn()
 {
     CURRENT_TURN = CURRENT_TURN == GameSide.LeftSide ? GameSide.RightSide : GameSide.LeftSide;
     GameView.SetImage("FlagColor", CURRENT_TURN == GameSide.LeftSide ? blueFlagSprite : redFlagSprite);
 }
Exemple #41
0
 public void Start()
 {
     gameView = GameObject.Find("CPU").GetComponent<GameView>();
     this.isEnermy = true;
     this.isDead = false;
 }
        public static void ShowCurrentTimeInsteadPoints(Storyboard animation, IMusicPlayerService musciPlayerService, GameView view)
        {
            #if DEBUG_TIMING
            new Thread(new ThreadStart(() =>
            {
                while (true)
                {
                    if (Application.Current == null)
                    {
                        return;
                    }

                    Application.Current.Dispatcher.BeginInvoke(new System.Action(() =>
                    {
                        var time = musciPlayerService.CurrentTime;
                        view.p1PointsBar.Points = "S: " + time.TotalSeconds.ToString("N2") + " | A: " + animation.GetCurrentTime().TotalSeconds.ToString("N2");
                    }));
                    Thread.Sleep(50);
                }
            })).Start();
            #endif
        }
        public HashSet <Player> PlayGameInView(HashSet <Player> players, GameView view, AutoResetEvent manualMoveAcceptBlock)
        {
            RestartGame();
            gameView = view;
            if (players.Count != 1)
            {
                throw new NotImplementedException("Tic tac toe is only for 2 players.");
            }
            Logger.LogInfo("Starting Tic Tac Toe game.");

            players.Add(opponent);

            Random rng = new Random();

            currentPlayerIndex        = (byte)rng.Next(2);
            startingPlayerIndex       = currentPlayerIndex;
            statistics.StartedPlaying = startingPlayerIndex == 0;
            Logger.LogInfo("Starting player is " + GetCurrentPlayer(players).GetType().Name + ".");

            Stopwatch gameTimer = Stopwatch.StartNew();

            do
            {
                if (manualMoveAcceptBlock != null)
                {
                    manualMoveAcceptBlock.WaitOne();
                }
                Player currentPlayer = GetCurrentPlayer(players);
                Logger.LogDebug(currentPlayer.GetType().Name + "'s move.");
                TicTacToeGameStateImpl currentGameState = (TicTacToeGameStateImpl)GetCurrentGameState();
                Stopwatch moveTimer = Stopwatch.StartNew();
                currentPlayer.PerformMove(this, currentGameState);
                moveTimer.Stop();
                if (currentPlayerIndex == 0)
                {
                    TicTacToeGameStateImpl startMove = GameStateFactory <TicTacToeGameStateImpl> .GetNewGameState(currentGameState);

                    TicTacToeGameStateImpl endMove = GameStateFactory <TicTacToeGameStateImpl> .GetNewGameState((TicTacToeGameStateImpl)GetCurrentGameState());

                    statistics.Moves.Add(new Tuple <GameState, GameState>(startMove, endMove));
                    statistics.MovesDurations.Add(moveTimer.Elapsed.TotalMilliseconds);
                }
                ReturnStatesToPool();
                ChangeToNextPlayer();
            }while (!game.IsGameFinished());
            gameTimer.Stop();
            statistics.GameDuration = gameTimer.Elapsed.TotalMilliseconds;

            byte winner = game.GetWinner();

            if (winner == 0)
            {
                statistics.Score = 0;
                Logger.LogInfo("Tic Tac Toe game ended in a tie.");
                return(new HashSet <Player>());
            }

            if ((winner == 1 && startingPlayerIndex == 0) ||
                (winner == 2 && startingPlayerIndex == 1))
            {
                statistics.Score = 1000;
                Logger.LogInfo("Tic Tac Toe game ended in a win");
                return(new HashSet <Player>()
                {
                    players.ElementAt(0)
                });
            }

            if ((winner == 1 && startingPlayerIndex == 1) ||
                (winner == 2 && startingPlayerIndex == 0))
            {
                statistics.Score = -1000;
                Logger.LogInfo("Tic Tac Toe game ended in a lose");
                return(new HashSet <Player>()
                {
                    players.ElementAt(1)
                });
            }

            return(new HashSet <Player>());
        }
 public GamePlayHandler(GameView gameView, GameManager gameManager)
 {
     this.gameView    = gameView;
     this.gameManager = gameManager;
     initEvents();
 }
Exemple #45
0
 // Load the content dude
 public void LoadContent(ContentManager content, string path)
 {
     texture       = content.Load <Texture2D>("Images/Background/dirt_background");
     iterateAmount = new Point((int)(GameView.GetView().X / texture.Width) + 3, (int)(GameView.GetView().Y / texture.Height) + 3);
 }
Exemple #46
0
 public GameViewTest()
 {
     sut = new GameView();
 }
Exemple #47
0
 public void UpdateFood(List <FoodData> food)
 {
     GameModel.UpdateFood(food);
     GameView.UpdateViews(food);
 }
Exemple #48
0
 public GameViewFlyout(GameView gameView)
 {
     InitializeComponent();
     _gameView = gameView;
 }
Exemple #49
0
 public void Dispose()
 {
     _gameInstance = null;
     worldData     = null;
     InputManager  = null;
 }
Exemple #50
0
        private void StartPlayerVsPlayerGame(object sender, RoutedEventArgs e)
        {
            var gameWindow = new GameView(new StrictGame());

            gameWindow.Show();
        }
Exemple #51
0
 void Awake()
 {
     context = new GameView(this);
     // context.Start();
 }
Exemple #52
0
        public void Select()
        {
            _Highlight.SetActive(true);

            GameView.Select();
        }
Exemple #53
0
 public static GameView GetGameView(GraphicsDevice graphicsDevice)
 {
     GameView view = new GameView(graphicsDevice);
     _views.Add(view);
     return view;
 }
Exemple #54
0
    void Start()
    {
        gameView      = app.view;
        boundaryModel = new BoundaryModel();
        playerModel   = app.model.playerSettings;

        //write and read to XML
        gameModel = fileSave.ReadXml <GameModel>();

        app.model    = gameModel;
        lvlDataModel = app.model.lvldata;
        //fileSave.WriteXml(gameModel);
        lvlStructSource = lvlDataModel.lvlStruct[lvlDataModel.currentLvl.Value - 1];


        PoolManager.init(poolGO, spawnAsteroidObj);


        //определяем границы камеры
        boundaryModel.SetBoundary(Camera.main.ViewportToWorldPoint(new Vector2(0, 0)), Camera.main.ViewportToWorldPoint(new Vector2(1, 1)));


        //наблюдаем за добавлением объекта в коллекцию астероидов
        app.model.getAsterCollection().ObserveAdd().Subscribe(x =>
        {
            GameObject obj = PoolManager.Get(asteroidsPref);
            obj.GetComponent <AsteroidView>().setModel(x.Value);
            x.Value.moveObject();
        });

        //наблюдаем за удалением объекта в коллекции астероидов
        app.model.getAsterCollection().ObserveRemove().Subscribe(x =>
        {
            Debug.Log("remove subscribe");
            PoolManager.Put(tmp);
        });

        //наблюдаем за добавлением объекта в коллекцию пуль
        app.model.getBulletCollection().ObserveAdd().Subscribe(x =>
        {
            GameObject obj = PoolManager.Get(bulletPref);
            obj.GetComponent <BulletView>().setModel(x.Value);
            x.Value.moveObject();
        });

        //наблюдаем за удалением объекта в коллекции пуль
        app.model.getBulletCollection().ObserveRemove().Subscribe(x =>
        {
            Debug.Log("remove subscribe");
            PoolManager.Put(tmp2);
        });

        //StartCoroutine(AsteroidsSpawn());


        Observable.EveryUpdate()
        .Where(_ => Input.anyKeyDown)
        .Select(_ => Input.inputString)
        .Subscribe(x => {
            OnKeyDown(x);
        }).AddTo(this);
    }
Exemple #55
0
 // Use this for initialization
 void Start()
 {
     viewType = EViewType.A;
     gameView = GameObject.Find("CPU").GetComponent<GameView>();
 }
Exemple #56
0
 public void Initiate(GameView gameView)
 {
     this.gameView = gameView;
     board         = gameView.gameEngine.board;
     DrawBoard();
 }
Exemple #57
0
 public GameView.Result Handle(GameView qry)
 => _ms.Handle(qry).response as GameView.Result;
Exemple #58
0
 private void OnPlayerTakeDamage(GameView inPlayer, Vector2 inDirection)
 {
 }
Exemple #59
0
 void Start()
 {
     isEnermy = false;
     actor_type = EActorType.Hero;
     cc = GetComponent<CharacterController>();
     state = new HeroActorState_Idle(this);
     gameView = GameObject.Find("CPU").GetComponent<GameView>();
 }
Exemple #60
0
	void Update () {
        // First remove any null (destroyed) gameobjects:
        activeEvents.RemoveAll(x => x == null);
        activeCount = activeEvents.Count;

        if (IsBlocked())
        {
            return;
        }
        // While there are events in the queue and we haven't spawned any blocking
        // events, dequeue and spawn:
        bool done = false;
        while(!done)
        {
            if(eventQueue.Count > 0)
            {
                GameEvent next = eventQueue.Dequeue();
                GameEventBehaviour eventBehaviour = SpawnEvent(next);
                if (eventBehaviour != null && eventBehaviour.IsBlocking) done = true;
            }
            else
            {
                done = true;
            }
        }
        
        // When the CommandManager isn't blocking, update the valid plays (which allows the player to act):
        if (!CommandManager.Instance.BlockingEvents)
        {
            if (updatedPlays != null)
            {
                CommandManager.Instance.ValidPlays = updatedPlays;
                updatedPlays = null;
            }
        }
        
        // When the GameEventQueue isn't blocking and there are no more events 
        // incoming, update the gameview, which theoretically shouldn't change
        // anything
        if (!IsBlocked() && eventQueue.Count == 0)
        {
            if (updatedView != null)
            {
                GameManager.Instance.UpdateView(updatedView);
                updatedView = null;
            }
        }
        
	}