// TODO: Refactor private IEnumerable <IGameObject> CreateTheDarkForestGameObjects(IGameScene gameScene) { // Blue Snail Game Object #1 { var id = idGenerator.GenerateId(); var position = new Vector2(-2f, -8.2f); var coroutineRunner = gameScene.PhysicsExecutor.GetCoroutineRunner(); var physicsWorldManager = gameScene.PhysicsWorldManager; var blueSnail = new BlueSnailGameObject(id, position, new IComponent[] { new PresenceMapProvider(gameScene), new BlueSnailMoveBehaviour(coroutineRunner, physicsWorldManager) }); var bodyData = blueSnail.CreateBodyData(); gameScene.PhysicsWorldManager.AddBody(bodyData); yield return(blueSnail); } // Portal Game Object #2 { var id = idGenerator.GenerateId(); var position = new Vector2(12.5f, -1.125f); var portal = new PortalGameObject(id, position, new IComponent[] { new PresenceMapProvider(gameScene), new PortalData(map: (byte)Map.Lobby) }); yield return(portal); } }
void Start() { switch (catId) { case -1: Application.Quit(); break; case 0: //gameScene = new Intelligence (); intelligenceLevels[0].SetActive(true); break; case 1: gameScene = new Typing(this); break; case 2: gameScene = new Tapping(this); break; case 3: wordMemoryLevels[0].SetActive(true); break; case 4: visualMemoryLevels[0].SetActive(true); break; } if (gameScene != null) { gameScene.Start(); } }
public StartUp(IGameScene gameScene, IMouse mouse, ISound sound) { GameScene = gameScene; Mouse = mouse; var parameters = new Parameters(); Sound = new PixSound(new Sounds(sound)); Drawer = new Drawer(parameters, gameScene); var IdProcessor = new BlockIdProcessor(); var tileManager = new TileManager(Drawer, IdProcessor, parameters); engine = new Engine.Engine(tileManager, Drawer); var craftingSystem = new CraftingModule(Craftings.GetCraftings(), tileManager); var StatusWindow = new InventoryForm(craftingSystem, engine, mouse, Drawer, gameScene); var playerstatus = new PlayerStatus(StatusWindow, parameters); var blockConverter = new BlockConverter(Drawer, IdProcessor); var moveDefiner = new PlayerMoveDefiner(gameScene, mouse); SaveManager = new SaveManager(tileManager, playerstatus, blockConverter, engine.Center, engine); var pauseMenu = new PauseForm(engine, SaveManager, mouse, Drawer, gameScene); var oreTable = new OreTable(OreResource.InitOreTable()); pointerController = new PointerController(playerstatus, tileManager, moveDefiner, Drawer, Sound, parameters, engine, mouse); player = new Player(pauseMenu, tileManager, moveDefiner, playerstatus, Drawer, engine, Sound, parameters, gameScene, pointerController); MobSpawner = new MobSpawner(engine, tileManager, Drawer, Sound, player); Generator = new Generator(tileManager, oreTable, Drawer, parameters); }
// TODO: Refactor private IEnumerable <IGameObject> CreateLobbyGameObjects(IGameScene gameScene) { // Guardian Game Object #1 { var id = idGenerator.GenerateId(); var position = new Vector2(-14.24f, -2.025f); var guardian = new GuardianGameObject(id, position, new IComponent[] { new PresenceMapProvider(gameScene), new GuardianIdleBehaviour(text: "Hello", time: 1) }); yield return(guardian); } // Portal Game Object #2 { var id = idGenerator.GenerateId(); var position = new Vector2(-17.125f, -1.5f); var portal = new PortalGameObject(id, position, new IComponent[] { new PresenceMapProvider(gameScene), new PortalData(map: (byte)Map.TheDarkForest) }); yield return(portal); } }
private static string TryParseInput(string PrevValue, bool IsNumber, IGameScene scene) { var input = scene.GetInput("Enter Value"); var isNumeric = int.TryParse(input, out _); return(isNumeric || !IsNumber ? input : PrevValue); }
public CraftingForm(CraftingModule craftingSystem, PlayerStatus inventory, Form previousForm, IMouse mouse, Engine.IDrawer drawer, IGameScene scene) : base(new Color(100, 200, 255), 300, previousForm, mouse, drawer) { this.craftingSystem = craftingSystem; this.inventory = inventory; Scene = scene; controls.Add(new Label(new Vector2(-80, 90), "Rcepies", 30, drawer, mouse)); allCraftings = new RadioList(new Vector2(-80, 70), 6, drawer, mouse); allCraftings.OnSelectionChange += AllCraftings_OnSelectionChange; controls.Add(allCraftings); controls.Add(new Label(new Vector2(0, 95), "Requirements", 30, drawer, mouse)); neededItems = new RadioList(new Vector2(0, 75), 2, drawer, mouse, true); controls.Add(neededItems); controls.Add(new Label(new Vector2(0, 20), "Inventory", 30, drawer, mouse)); havedItems = new RadioList(new Vector2(0, 0), 4, drawer, mouse, true); controls.Add(havedItems); controls.Add(new Button(new Vector2(-50, -90), "Craft", 20, CraftItem, drawer, mouse) { color = new Color(204, 51, 153) }); controls.Add(new Button(new Vector2(-50, -60), "Filter", 20, Filter, drawer, mouse) { color = new Color(104, 51, 153) }); }
void SetScene(IGameScene scene) { //Remove all components from the engine this.physicsGame.RemoveAllComponents(); scene.InitializeScene(); activeScene = scene; physicsGame.ActiveCamera = activeScene.DefaultCamera; }
public void RegisterScene(IGameScene scene) { this.scenes.Add(scene); if (this.currentScene == null && scene.IsDefaultScene) { SwitchScene(scene); } }
public MainMenu(IMouse mouse, Engine.IDrawer drawer, IGameScene scene, StartUp init) : base(new Color(0, 100, 100), 300, null, mouse, drawer) { var options = new Box[] { new Box("Start", SwichToNewWorldForm), new Box("Load World", SwichToLoadWorldForm) }; controls.Add(new Label(new Vector2(0, 80), "PixCraft", 200, drawer, mouse)); controls.Add(new Label(new Vector2(90, -90), "V.2.0", 20, drawer, mouse)); optionsWindow = new SelectBox(new Vector2(0, 0), options, drawer, mouse); controls.Add(optionsWindow); LoadWorldform = new LoadWorldForm(this, mouse, drawer, scene, init); NewWorldForm = new NewWorldForm(this, init, mouse, drawer, scene); }
/// <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); Assets.Effects.Add("GUI", Content.Load <Effect>("GUI")); Assets.SpriteFonts.Add("UIFontO", Content.Load <SpriteFont>("UIFontO")); // TODO: use this.Content to load your game content here this.CurrentScene = new GameScenes.MainGame(); this.CurrentScene.Init(GraphicsDevice); }
public Player(PauseForm pauseMenu, IActiveElements activeElements, IMoveDefiner definer, PlayerStatus status, IDrawer drawer, IMover mover, IPixSound sound, IMovableObjectParameters parameters, IGameScene scene, PointerController pointer) : base(activeElements, drawer, definer, status, sound, parameters) { position = new Vector2(0, 0); size = 10; image = 0; status.OnKill = KillPlayer; settingsForm = pauseMenu; Mover = mover; Scene = scene; Pointer = pointer; }
/// <summary> /// 清空场景 /// </summary> public static void Clear() { mbSceneLoaded = false; mstrSceneID = string.Empty; //场景编号 mintRegionID = -1; //区域地图服务器编号,需要转成地图编号; mScene = null; //场景数据对象 //scene = null; sceneFileDir = string.Empty; mSceneChanged.ClearCalls(); sceneID = -1; }
public void Start() { try { gameOver = new GameOverMenu(); game = new GameScene(); menu = new MainMenu(); Log.Instance.Write("Game scene init started"); game.SetController(this); game.SetRenderSurface(surface); game.SetSound(sound); game.Initialize(menu, gameOver); game.LoadResources(); game.Reset(); Log.Instance.Write("Game scene init completed"); Log.Instance.Write("Menu scene init started"); menu.SetController(this); menu.SetRenderSurface(surface); menu.SetSound(sound); menu.Initialize(game); menu.LoadResources(); Log.Instance.Write("Menu scene init completed"); Log.Instance.Write("GameOver scene init started"); gameOver.SetController(this); gameOver.SetRenderSurface(surface); gameOver.SetSound(sound); gameOver.Initialize(game); gameOver.LoadResources(); Log.Instance.Write("GameOver scene init completed"); } catch (Exception ex) { Log.Instance.Write("ERROR: Controller.Start() : " + Environment.NewLine + "\t\t" + ex.ToString()); } currentScene = menu; Render(); }
private void SwitchScene(IGameScene scene) { if (scene == currentScene) { return; } if (currentScene != null) { currentScene.Deactivate(); Debug.Log($"Switch scene from {currentScene.SceneId} to {scene.SceneId}"); } else { Debug.Log("Switch scene to " + scene.SceneId); } currentScene = scene; currentScene.Activate(); }
public CreateUnitsAction(IGameScene gameScene, IUnitsFactory unitsFactory, ICommandsManager commandsManager) { _gameScene = gameScene; _unitsFactory = unitsFactory; _commandsManager = commandsManager; }
public void SetMap(IGameScene gameScene) { this.gameScene = gameScene; SetRegion(); }
public PresenceMapProvider(IGameScene gameScene = null) { this.gameScene = gameScene; }
public bool Add(Map map, IGameScene gameScene) { return(collection.TryAdd(map, gameScene)); }
public AttackUnitAction(IGameScene gameScene, IUnitsFactory unitsFactory, ICommandsManager commandsManager) { _unitsFactory = unitsFactory; _commandsManager = commandsManager; _gameScene = gameScene; }
public void UnregisterScene(IGameScene scene) { this.scenes.Remove(scene); }
public SceneClickAction(IGameScene gameScene, IPublisher publisher) { _gameScene = gameScene; _publisher = publisher; }
private static void Task(PixControl item, bool IsNumber, IGameScene scene) { var button = item as Button; button.label.text = TryParseInput(button.label.text, IsNumber, scene); }
/* @brief:进入场景消息入口点 * @param: args 该事件参数列表 * @return void */ public static void on_entry_scene(VarList args) { ConnectStage.mbTryingConnect = false; ConnectStage.mbLoginSuccess = true; ConnectStage.isChangeRole = false; if (TimerManager.IsHaveTimer("OnNetBlockTimer")) { TimerManager.Destroy("OnNetBlockTimer"); } // if (LoginStage.isNewCreateRole) // { // DataCollectionManager.Instance.SubmitCollect(DataCollectType.CREATE_ROLE); // #if UNITY_IPHONE || UNITY_ANDROID // Handheld.PlayFullScreenMovie("movie.mp4", Color.black, FullScreenMovieControlMode.CancelOnInput); // DataCollectionManager.Instance.SubmitCollect(DataCollectType.DIS_CONNECT); // #endif // // LoginStage.isNewCreateRole = false; // } if (ConnectStage.mbNeedReConnect) { ConnectStage.mbNeedReConnect = false; } if (ConnectStage.mbSecondTimeConnect) { ConnectStage.mbSecondTimeConnect = false; } LogSystem.Log("Begin on_entry_scene"); bool isChangeScene = false; int iRegionId = 0; mScene = Game.Instance.mGameClient.GetCurrentScene(); if (mScene != null) { if (mScene.QueryPropInt("ID", ref iRegionId)) { if (sceneID != iRegionId) { isChangeScene = true; } else if (!WorldStage.mbReConnected) { //如果正常切场景、则相同场景也重新加载场景 isChangeScene = true; } else { OnLeaveScene(); } } } ObjectManager.RemovePlayerAll(); ObjectManager.bSceneExist = false; ///检查场景是否需要更新 if (isChangeScene) { string strSceneID = string.Empty; mScene.QueryPropString("Resource", ref strSceneID); mstrSceneID = strSceneID; sceneID = iRegionId; } LogSystem.Log("End on_entry_scene"); SceneManager.Instance.ChangeScene("Scene_Test"); }
public SceneClickHandler(IGameScene gameScene, IEventsManager publisher) { _gameScene = gameScene; _publisher = publisher; }
public bool TryGet(Map map, out IGameScene gameScene) { return(collection.TryGetValue(map, out gameScene)); }
public Drawer(IDrawerParameters parameters, IGameScene gameScene) { Parameters = parameters; GameScene = gameScene; }
public void Initialize(IGameScene game) { this.game = game; }
public PauseForm(Engine.Engine engine, SaveManager manager, Integration.IMouse mouse, Engine.IDrawer drawer, IGameScene scene) : base(new Color(204, 153, 51), 150, null, mouse, drawer) { var list = new Box[] { new Box("Resume", Resume), new Box("Save", Save) }; selectBox = new SelectBox(new Vector2(0, 20), list, drawer, mouse); controls.Add(selectBox); this.engine = engine; this.manager = manager; SaveForm = new SaveWorldForm(manager, this, mouse, drawer, scene); }
void sceneGameSelection_OnGameSelected(object sender, EventArgs e) { IGameScene scene = (IGameScene)Activator.CreateInstance(sceneTypes[sceneGameSelection.SelectedGameIndex], this.physicsGame, this); SetScene(scene); }
public SaveWorldForm(SaveManager manager, Form PrevForm, IMouse mouse, Engine.IDrawer drawer, IGameScene scene) : base(new Color(200, 100, 0), 300, PrevForm, mouse, drawer) { controls.Add(new Label(new Vector2(0, 40), "Enter path to file", 50, drawer, mouse)); txtFile = new Button(new Vector2(0, 0), " ", 50, StaticExtensions.configureAsTextBox(false, scene), drawer, mouse); controls.Add(new Button(new Vector2(0, -50), "Save world", 50, SaveSave, drawer, mouse)); controls.Add(txtFile); this.manager = manager; }
public ClickUnitAction(IGameScene gameScene, ICommandsManager commandsManager) { _gameScene = gameScene; _commandsManager = commandsManager; }
public static Action <PixControl> configureAsTextBox(bool IsNumber, IGameScene scene) { return((s) => Task(s, IsNumber, scene)); }