// Use this for initialization void Start() { //screenController = gameObject.AddComponent<ScreenController> (); // AddComponent adds other gameobjects to the current of type classname //screenController = gameObject.GetComponent<ScreenController> (); screenController = GameObject.Find ("Main Camera").GetComponent<ScreenController>(); /* * the above line basically finds a game object called Main Camera, and gets a component which we specify to be ScreenController * since ScreenController was instantiated by Main Camera, Start and Update works and will give off the proper values here when we call the getter functions * there is AddComponent, GetComponent and Instantiate, 2 of these adds a "new" object/element */ ScreenHeight = screenController.GetScreenHeight(); ScreenWidth = screenController.GetScreenWidth(); //Debug.Log (ScreenHeight + ", " + ScreenWidth); }
private void GoToFarm() { RestrictionInput.StartLoad(RestrictionInput.LoadType.LARGE_IMAGE_MASK_OFF); ScreenController.ChangeHomeScreen(CMD_Tips.DISPLAY_PLACE.BattleToFarm); }
public static bool IsAnySquadScreenOpen() { ScreenController screenController = Service.ScreenController; return(screenController.GetHighestLevelScreen <SquadBuildingScreen>() != null || screenController.GetHighestLevelScreen <SquadCreateScreen>() != null || screenController.GetHighestLevelScreen <SquadIntroScreen>() != null || screenController.GetHighestLevelScreen <SquadJoinRequestScreen>() != null || screenController.GetHighestLevelScreen <SquadJoinScreen>() != null || screenController.GetHighestLevelScreen <AbstractSquadRequestScreen>() != null || screenController.GetHighestLevelScreen <SquadSlidingScreen>() != null || screenController.GetHighestLevelScreen <SquadTroopRequestScreen>() != null || screenController.GetHighestLevelScreen <SquadUpgradeScreen>() != null); }
public SettingScreen(ScreenController controller, Renderer renderer, SoundController soundController, PlayerInfo playerInfo, StorageManager storageManager) : base(controller, renderer, soundController, playerInfo) { this.storageManager = storageManager; }
public ArmyScreen(ScreenController controller, Renderer renderer, SoundController soundController, PlayerInfo info) : base(controller, renderer, soundController, info) { }
// Use this for initialization void Start() { restController = GameObject.FindObjectOfType <RestController>(); screenController = GameObject.FindObjectOfType <ScreenController>(); gotoStartScreen(); }
private void Cycle() { ScreenController.Clear(); ScreenController.Write("You travel to work by bike."); Console.ReadLine(); }
public RequestHelper() { screenController = ApiUtilities.CreateInstance <ScreenController>(); areaController = ApiUtilities.CreateInstance <AreaController>(); cityController = ApiUtilities.CreateInstance <CityController>(); }
public MainMenu() { ScreenController.Clear(); AddDecisions(); Run(); }
public void MakeMove(Position origin, Position destiny) { Piece takenPiece = ChessMove(origin, destiny); if (IsInCheck(CurrentPlayer)) { UndoChessMove(origin, destiny, takenPiece); throw new BoardExceptions("You can not put your self in check"); } Piece movedPiece = Board.GetPiece(destiny); //Special move: Pawn Promotion if (movedPiece is Pawn) { if ((movedPiece.Color == Color.White && destiny.Line == 0) || (movedPiece.Color == Color.Black && destiny.Line == 7)) { Board.RemovePiece(destiny); GamePieces.Remove(movedPiece); Console.WriteLine("Type the kind of piece you want to promote your pawn to"); Console.Write("(QUEEN / ROOK / KNIGHT / BISHOP): "); string playerChoice = Console.ReadLine(); if (!ScreenController.CheckPlayerChoice(playerChoice)) { throw new BoardExceptions("Not valid option"); } playerChoice = playerChoice.ToLower(); switch (playerChoice) { case "queen": { Piece newPiece = new Queen(movedPiece.Color, Board); Board.AddressPiece(newPiece, destiny); GamePieces.Add(newPiece); break; } case "rook": { Piece newPiece = new Rook(movedPiece.Color, Board); Board.AddressPiece(newPiece, destiny); GamePieces.Add(newPiece); break; } case "knight": { Piece newPiece = new Knight(movedPiece.Color, Board); Board.AddressPiece(newPiece, destiny); GamePieces.Add(newPiece); break; } case "bishop": { Piece newPiece = new Bishop(movedPiece.Color, Board); Board.AddressPiece(newPiece, destiny); GamePieces.Add(newPiece); break; } } } } //EndGame Pawn Promotion if (IsInCheck(EnemyIs(CurrentPlayer))) { PlayerInCheck = true; } else { PlayerInCheck = false; } if (IsInCheckMate(EnemyIs(CurrentPlayer))) { EndGame = true; } else { Turn++; MudaJogador(); } //Special move: en passant if (movedPiece is Pawn && (destiny.Line == origin.Line + 2 || destiny.Line == origin.Line - 2)) { VulnerableToEnPassant = movedPiece; } else { VulnerableToEnPassant = null; } }
void Start() { sc = GetComponent <ScreenController>(); sc.OnOpenComplete += sc_OnOpenComplete; scrollBar.onValueChanged.AddListener(UpdateFollows); }
public ScreenStart(ScreenController screenController) : base(screenController) { }
public virtual void Show(ScreenController p) { previous = p; previous.Hide(); Show(); }
void Start() { controller = GameObject.FindGameObjectWithTag("GameController").GetComponent <ScreenController>(); }
/// <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); mapManager.LoadContent(spriteBatch); Screen = new ScreenController(graphics.GraphicsDevice.Viewport, Vector2.Zero); SpriteSheetManager.Instance.LoadContent(Content); spriteFont = Content.Load<SpriteFont>("LunchdoubleSo"); // TODO: use this.Content to load your game content here }
private void CheckGameState() { // Populates the arrays properly if (gameState == "intro") { if (update == false) { update = true; } } // Begins the opening narrations if (gameState == "narrate") { if (update == false) { screens.setScreen(0); whitefading.WhiteFadeAnimation(); narrator.playClip(0); audience.playClip(1); lighting.ActivateLight(1); lighting.ActivateLight(2); update = true; Slideshow = true; } if (audience.checkIfPlay() == false) { audience.playClip(9); print("test audio"); } // Moves on to the next game state when the clip ends if (narrator.soundClips[0].isPlaying == false || Input.GetKey(KeyCode.Escape)) { update = false; gameState = "narrateToGame1"; lighting.ActivateLight(5); Slideshow = false; screens.setScreen(7); print("Test 1"); } } // if (gameState == "narrateToGame1") { if (update == false) { screens.setScreen(1); narrator.playClip(1); teleport1.Activate(); update = true; playerControl.velocityModifier = 10; } } if (gameState == "Game1") { if (update == false) { Room1.SetActive(false); Room2.SetActive(true); screens = Room2.transform.GetChild(2).GetComponent <ScreenController>(); screens.GetScreens(); screens.setScreen(2); lighting = Room2.transform.GetChild(3).GetComponent <Lighting>(); lighting.GetLights(); lighting.ActivateAllLights(); playerControl.setRoom1(); update = true; Slideshow = true; } if (playerControl.victory) { gameState = "Game1toGame2"; Slideshow = false; screens.setScreen(9); audience.playNoInterruptClip(4); narrator.playClip(7); update = false; } } if (gameState == "Game1toGame2") { if (update == false) { teleport2.Activate(); update = true; } } if (gameState == "Game2") { if (update == false) { Room2.SetActive(false); Room3.SetActive(true); screens = Room3.transform.GetChild(2).GetComponent <ScreenController>(); screens.GetScreens(); screens.setScreen(2); lighting = Room3.transform.GetChild(3).GetComponent <Lighting>(); lighting.GetLights(); lighting.ActivateAllLights(); playerControl.setRoom2(); update = true; Slideshow = true; } if (playerControl.victory) { gameState = "Game2toConclusion"; Slideshow = false; screens.setScreen(9); audience.playNoInterruptClip(4); narrator.playClip(7); update = false; } } if (gameState == "Game2toConclusion") { if (update == false) { screens.setScreen(0); update = true; teleport3.Activate(); } } if (gameState == "Conclusion") { if (update == false) { Room4.SetActive(true); Room3.SetActive(false); screens = Room4.transform.GetChild(0).GetComponent <ScreenController>(); lighting = Room4.transform.GetChild(1).GetComponent <Lighting>(); screens.GetScreens(); screens.setScreen(0); lighting.GetLights(); lighting.ActivateAllLights(); update = true; Slideshow = false; screens.setScreen(9); audience.playClip(9); narrator.playClip(10); timer3 = 3.0f; } if (Input.GetKey(KeyCode.Escape)) { SceneManager.LoadScene(0, LoadSceneMode.Single); } } }
private void Run() { ScreenController.Write("Adventure Game"); ShowMenuOptions(); }
private void Walk() { ScreenController.Clear(); ScreenController.Write("You travel to work by foot."); Console.ReadLine(); }
void Start () { Instance = this; sr = GetComponent<SpriteRenderer>(); ResizeBackground(); }
// ------------------------------------------- /* * Global manager of events */ protected virtual void OnMenuEvent(string _nameEvent, params object[] _list) { if (this == null) { return; } if (this.gameObject == null) { return; } if ((_nameEvent == KeysEventInputController.ACTION_KEY_UP_PRESSED) || (_nameEvent == KeysEventInputController.ACTION_KEY_DOWN_PRESSED) || (_nameEvent == KeysEventInputController.ACTION_KEY_LEFT_PRESSED) || (_nameEvent == KeysEventInputController.ACTION_KEY_RIGHT_PRESSED)) { EnableSelector(); } if (_nameEvent == EVENT_SCREENBASE_ANIMATION_SHOW) { if (this.gameObject == (GameObject)_list[0]) { AppearAnimation(((List <object>)_list[1]), false); } } if (_nameEvent == EVENT_SCREENBASE_ANIMATION_HIDE) { if (this.gameObject == (GameObject)_list[0]) { bool noAnimation = (_list.Length > 2); DisappearAnimation((_list.Length > 1)?((List <object>)_list[1]):null, false, !noAnimation); } } if (_nameEvent == EVENT_SCREENBASE_FORCE_HIDE) { if (this.gameObject == (GameObject)_list[0]) { DisappearAnimation((_list.Length > 1) ? ((List <object>)_list[1]) : null, false, false); } } if (_nameEvent == EVENT_SCREENBASE_ANIMATION_SLIDE_APPLY) { List <object> currentParamsSlide = (List <object>)_list[0]; bool applySlide = true; if (_list.Length > 1) { for (int i = 1; i < _list.Length; i++) { if (this.gameObject == (GameObject)_list[i]) { applySlide = false; } } } if (applySlide) { m_paramsSlide.Add(currentParamsSlide); AppearAnimation(currentParamsSlide, true); } } if (_nameEvent == EVENT_SCREENBASE_ANIMATION_SLIDE_RECOVER) { if (this.gameObject != (GameObject)_list[0]) { if (m_paramsSlide.Count > 0) { List <object> currentParamsSlide = m_paramsSlide[m_paramsSlide.Count - 1]; m_paramsSlide.RemoveAt(m_paramsSlide.Count - 1); DisappearAnimation(currentParamsSlide, true); } } } if (_nameEvent == EVENT_SCREENBASE_ANIMATION_SLIDE_RESET) { if (!((_list != null) && (_list.Length != 0) && (this.gameObject == (GameObject)_list[0]))) { m_canvasGroup.gameObject.transform.position = Utilities.Clone(m_initialPosition); } } if (_nameEvent == EVENT_SCREENBASE_BLOCK_INTERACTION) { m_blocksInteraction = (bool)_list[0]; } if (_nameEvent == EVENT_SCREENBASE_CLEAR_ANIMATION_PARAMS) { m_paramsAnimation = null; } if (_nameEvent == ScreenController.EVENT_SCREENCONTROLLER_REPLACE_LOGO) { if (m_containerBase != null) { Transform logo = m_containerBase.Find("Logo"); if (logo != null) { logo.GetComponent <Image>().sprite = (Sprite)_list[0]; } } } if (_nameEvent == UIEventController.EVENT_SCREENMANAGER_DESTROY_NAME_SCREEN) { Debug.LogError("EVENT_SCREENMANAGER_DESTROY_NAME_SCREEN::(string)_list[0][" + (string)_list[0] + "]!!!!!!!!!!!!!!!!!!!!"); if (this.gameObject.name.IndexOf((string)_list[0]) != -1) { Debug.LogError(" DESTROYED(string)_list[0][" + (string)_list[0] + "]+++++++++++++"); Destroy(); } } if (_nameEvent == EVENT_SCREENBASE_RESPONSE_SCREENVIEW_IN_POOL) { bool isVRScreen = (bool)_list[0]; GameObject originGO = (GameObject)_list[1]; if (originGO == this.gameObject) { GameObject screenView = (GameObject)_list[2]; string previousScreenName = (string)_list[3]; ScreenController screenController = GameObject.FindObjectOfType <ScreenController>(); if (screenView != null) { screenView.GetComponent <IBasicView>().SetActivation(true); Destroy(); } else { if (screenController.AlphaAnimationNameStack == -1) { UIEventController.Instance.DispatchUIEvent(UIEventController.EVENT_SCREENMANAGER_OPEN_GENERIC_SCREEN, previousScreenName, UIScreenTypePreviousAction.DESTROY_ALL_SCREENS, true, null); } else { UIEventController.Instance.DispatchUIEvent(UIEventController.EVENT_SCREENMANAGER_OPEN_LAYER_GENERIC_SCREEN, -1, new List <object> { ScreenController.ANIMATION_ALPHA, 0f, 1f, screenController.AlphaAnimationNameStack }, previousScreenName, UIScreenTypePreviousAction.DESTROY_ALL_SCREENS, true, null); } } } } if (!this.gameObject.activeSelf) { return; } if (m_selectors == null) { return; } if (m_selectors.Count == 0) { return; } if (!m_hasFocus) { return; } if (_nameEvent == KeysEventInputController.ACTION_BUTTON_DOWN) { if ((m_selectionButton >= 0) && (m_selectionButton < m_selectors.Count)) { if (m_selectors[m_selectionButton] != null) { if (m_selectors[m_selectionButton].GetComponent <SelectableButtonView>() != null) { if (m_selectors[m_selectionButton].activeSelf) { m_selectors[m_selectionButton].GetComponent <SelectableButtonView>().InvokeButton(); } } } } } bool keepSearching = true; // KEYS ACTION if (_nameEvent == KeysEventInputController.ACTION_KEY_UP_PRESSED) { do { m_selectionButton--; if (m_selectionButton < 0) { m_selectionButton = m_selectors.Count - 1; } if (m_selectors[m_selectionButton] == null) { keepSearching = true; } else { keepSearching = !m_selectors[m_selectionButton].activeSelf; } } while (keepSearching); EnableSelector(); } if (_nameEvent == KeysEventInputController.ACTION_KEY_DOWN_PRESSED) { do { m_selectionButton++; if (m_selectionButton > m_selectors.Count - 1) { m_selectionButton = 0; } if (m_selectors[m_selectionButton] == null) { keepSearching = true; } else { keepSearching = !m_selectors[m_selectionButton].activeSelf; } } while (keepSearching); EnableSelector(); } if (_nameEvent == KeysEventInputController.ACTION_KEY_LEFT_PRESSED) { do { m_selectionButton--; if (m_selectionButton < 0) { m_selectionButton = m_selectors.Count - 1; } if (m_selectors[m_selectionButton] == null) { keepSearching = true; } else { keepSearching = !m_selectors[m_selectionButton].activeSelf; } } while (keepSearching); EnableSelector(); } if (_nameEvent == KeysEventInputController.ACTION_KEY_RIGHT_PRESSED) { do { m_selectionButton++; if (m_selectionButton > m_selectors.Count - 1) { m_selectionButton = 0; } if (m_selectors[m_selectionButton] == null) { keepSearching = true; } else { keepSearching = !m_selectors[m_selectionButton].activeSelf; } } while (keepSearching); EnableSelector(); } }
// Use this for initialization void Start() { nextSpawnTime = timeBetweenSpawns; screenController = GameObject.FindObjectOfType <ScreenController>(); player = GameObject.FindWithTag("Player").transform; }
void Start() { Instance = this; anim = GetComponent <Animator> (); }
public void MainMenu() { ScreenController.Change("MainMenu"); }
public ScreenWorld(ScreenController screenController) : base(screenController) { _cameraController = new CameraController(); _mapController = new MapController("test", _cameraController); _entities = new Entities(); }
public void Profile() { ScreenController.Change("Profile"); StartCoroutine(UpdateProfile()); }
private void HandleBackButton() { IState currentState = Service.GameStateMachine.CurrentState; if (currentState is IntroCameraState) { IntroCameraAnimation intro = Service.UXController.Intro; if (intro != null) { intro.FinishUp(true); } return; } for (int i = this.backButtonHandlers.Count - 1; i >= 0; i--) { if (this.backButtonHandlers[i].HandleBackButtonPress()) { return; } } UICamera.selectedObject = null; UICamera.hoveredObject = null; if (TouchScreenKeyboard.visible) { return; } ScreenController screenController = null; if (Service.ScreenController != null) { screenController = Service.ScreenController; AlertScreen highestLevelScreen = screenController.GetHighestLevelScreen <AlertScreen>(); if (highestLevelScreen != null && highestLevelScreen.IsAlwaysOnTop) { this.HandleScreenBack(highestLevelScreen); return; } } if (Service.HoloController != null) { HoloController holoController = Service.HoloController; if (holoController.HasAnyCharacter()) { Service.EventManager.SendEvent(EventId.StoryNextButtonClicked, null); return; } } if (screenController != null) { ScreenBase highestLevelScreen2 = screenController.GetHighestLevelScreen <ScreenBase>(); ClosableScreen highestLevelScreen3 = screenController.GetHighestLevelScreen <ClosableScreen>(); if (Service.CurrentPlayer.CampaignProgress.FueInProgress || Service.UserInputInhibitor.IsDenying()) { if (highestLevelScreen2 != null && highestLevelScreen2.AllowFUEBackButton && this.HandleScreenBack(highestLevelScreen2)) { return; } this.TryQuit(); return; } else { if (highestLevelScreen2 != null && this.HandleScreenBack(highestLevelScreen2)) { return; } if (highestLevelScreen3 != null && this.HandleScreenBack(highestLevelScreen3)) { return; } } } if (currentState is EditBaseState) { HomeState.GoToHomeState(null, false); return; } if (Service.BuildingController != null) { BuildingController buildingController = Service.BuildingController; if (buildingController.SelectedBuilding != null) { buildingController.EnsureDeselectSelectedBuilding(); return; } } if (currentState is BaseLayoutToolState) { UXController uXController = Service.UXController; uXController.HUD.BaseLayoutToolView.CancelBaseLayoutTool(); return; } if (Service.GalaxyViewController != null && currentState is GalaxyState) { GalaxyViewController galaxyViewController = Service.GalaxyViewController; galaxyViewController.GoToHome(); return; } this.TryQuit(); }
public IEnumerator WaitForReady() { yield return(new WaitForSeconds(.5f)); if (!GameEnded) { WWWForm form = new WWWForm(); form.AddField("id", MatchId); WWW w = new WWW(SERVER_ADDRESS + "?act=read_match", form); yield return(w); if (!string.IsNullOrEmpty(w.error)) { print(w.error); } else { print(w.text); string[] datas = w.text.Split(';'); bool p1_ready = false; bool p2_ready = false; string map = null; foreach (string data in datas) { string[] keypair = data.Split('='); switch (keypair[0]) { case "p1_ready": p1_ready = keypair[1] == "1" ? true : false; break; case "p2_ready": p2_ready = keypair[1] == "1" ? true : false; break; case "map1": if (!IsPlayer1) { map = keypair[1].Replace('$', '=').Replace('&', ';'); } break; case "map2": if (IsPlayer1) { map = keypair[1].Replace('$', '=').Replace('&', ';'); } break; } } if (p1_ready && p2_ready) { GameEnded = false; CellController.ClearSelection(); ScreenController.Change("MainGame"); MainGameTitle.text = IsPlayer1 ? "Your turn" : "Enemy's turn"; if (!IsPlayer1) { StartCoroutine(WaitForTurn()); } CellController.Locked = !IsPlayer1; CellController.Attack = true; if (map != null) { LoadMap(map); } } else { StartCoroutine(WaitForReady()); } } } }
private void Awake() { Instance = this; }
private void Display() { UpdateQuestion(); ScreenController.Write(_question); }
private void AppBar_ReturnBackClick(object sender, RoutedEventArgs e) => ScreenController.ReturnBack();
public void Sceen() { ScreenController clone = GameObject.Instantiate <ScreenController> (Blackscreen, GetComponent <Transform> ().position, Quaternion.identity); }
private ScreenController ScreenController; //Updates the screencolor void Start() { //ButtonController = GetComponentInChildren<ButtonPress>(); ScreenController = GetComponentInChildren <ScreenController>(); }
public MapScreen(ScreenController controller, Renderer renderer, SoundController soundController, PlayerInfo playerInfo) : base(controller, renderer, soundController, playerInfo) { this.playerInfo = playerInfo; }
void Awake() { instance = this; }
void Start() { sc = GetComponent<ScreenController>(); sc.OnOpenComplete += sc_OnOpenComplete; scrollBar.onValueChanged.AddListener(UpdateFollows); }