public LoadController() { gameManager.RegisterEventHandler( "GAME_LOAD_COMPLETE", ProcessLoadEvent); tempInfoStorage = ""; countOutgoingEvents = 0; gameManager = GameManager.Instance; gameScenario = GameScenario.Instance; }
void Awake() { //initialize gm = GameManager.Instance; Log.Assert(gm != null, "Can't create GameManager!"); Log.Assert(object1, "Missing object1"); Log.Assert(object2, "Missing object2"); Log.Assert(object3, "Missing object3"); Log.Assert(object4, "Missing object4"); }
/// <summary> /// Awake this instance. /// </summary> void Awake() { Debug.Log("<color=cyan>"+gameObject.name+"</color> AWAKEN"); //get managers uiManager = UIManager.Instance; gpm = GameManager.Instance; //TODO dynamic creation from file //uiManager.CreateFromFile("Config/screen"); if (btnMir == null) Debug.LogError("No <color=cyan>btnMir</color> assigned to:<color=cyan>"+gameObject.name+"</color>"); if (bgScreen == null) Debug.LogError("No <color=cyan>bgScreen</color> assigned to:<color=cyan>"+gameObject.name+"</color>"); //use static creation for now //uiManager.AddButton(btnMir, "Sprites/btn_erzaehls_mir", nextScreen, null /*testOnRelease*/, null /*testOnOver*/); UIButton button = (UIButton)uiManager.Add(UIType.Button, btnMir, "Sprites/btn_erzaehls_mir"); button.Register(UIEvent.Click, nextScreen); }
// Use this for initialization void Awake() { Debug.Log("<color=cyan>START GAME</color>"); if (startText == null) Debug.LogError("No <color=cyan>startText</color> assigned to:<color=cyan>"+gameObject.name+"</color>"); if (screen1 == null) Debug.LogError("No <color=cyan>screen1</color> assigned to:<color=cyan>"+gameObject.name+"</color>"); if (screen2 == null) Debug.LogError("No <color=cyan>screen2</color> assigned to:<color=cyan>"+gameObject.name+"</color>"); UIManager ui = UIManager.Instance; UIManager.ScreenChanged = notifyScreenChanged; ui.AddScreen(screen1); ui.AddScreen(screen2); ui.ActivateScreen(screen1.name); startText.SetActive(false); //localisation i18nManager = I18nManager.Instance; i18nManager.SetLanguage(lang); //add an empty main game GMGame game = new GMGame("TestGame"); gm = GameManager.Instance; ACondition falseCond = new FalseCondition(); ACondition trueCond = new TrueCondition(); ACondition relTimeCond = new TimerCondition(TimerType.Absolute, 8, game.TimeSource); //true after 1sec //this will only be fired, when both fireCondition is true at the same time ScriptTrigger<string> trigger3 = new ScriptTrigger<string>(); trigger3.Value = "TestGame"; trigger3.Function = TestScriptFunctionString; trigger3.Priority = 1; trigger3.Repeat = 1; //only fire once trigger3.FireCondition += trueCond.Check; //always true, but you can check sg extra here trigger3.FireCondition += relTimeCond.Check; //should fire only when time reached trigger3.DeleteCondition = falseCond.Check; //don't remove until repeating gm.Add (game); game.AddTrigger(trigger3); Debug.Log (" ----> AddTrigger 3"); gm.Start(game.Name); }
/// <summary> /// Initializes a new instance of the <see cref="UIManager"/> class. /// </summary> public UIManager() { // Log.Debug("<color=yellow>UIManager initialized.</color>"); InternalInit(); //save start screen size scrWidth = Screen.width; scrHeight = Screen.height; fullScreen = Screen.fullScreen; gpm = GameManager.Instance; lastId = 0; //InitUI(); }//ctor()
/// TODO this might goes to CTOR? /// <summary> /// Basic initialization /// </summary> public virtual void InitScreen() { Log.Assert(nextDefaultScreenName != "", "Missing nextDefaultScreenName, please set one in "+gameObject.name); uiManager = UIManager.Instance; gameManager = GameManager.Instance; audioManager = AudioManager.Instance; i18n = I18nManager.Instance; UIManager.UICamera.cullingMask = layerMask; //set every hud active, which used in this screen if(huds != null && hudDefaultTransforms != null) { Log.Assert(hudDefaultTransforms.Count == huds.Count); for (int i = 0; i < huds.Count; i++) { GameObject obj = uiManager.GetHud(huds[i]); obj.SetActive(true); obj.transform.position = hudDefaultTransforms[i].position; obj.transform.localScale = hudDefaultTransforms[i].localScale; obj.transform.rotation = hudDefaultTransforms[i].rotation; } } //set every popup inactive, which used in this screen if(popups != null) { foreach(string name in popups) { GameObject obj = uiManager.GetPopup(name); obj.SetActive(false); } } }
// Use this for initialization public virtual void Awake() { Log.Debug("__________________________________ AWAKE _____________________________"); parameters = new Dictionary<string, string>(); // if(useDBModule) // { // // StartCoroutine("xmlLoadRoutine"); // LoadAppConfigurationXml(); // } //testParameters instead of document.location.search // for testing Web Player: Variables in PHP are // $UserName and $SessionToken Log.Level = logLevel; Log.Info("Starting MainGame ... name "+this.name); ui = UIManager.Instance; ui.InitUI(gameObject); if (!GameManager.Instance.offline) GameManager.Instance.offline = offline; else offline = GameManager.Instance.offline; ui.ConfigResources = configResources; if(tooltip) ui.Tooltip = (UITooltip)Instantiate(tooltip, Vector3.zero, Quaternion.identity); //set ui camera to custom 2D camera Log.Assert(camera2D != null, "You have to assign a 2D camera in "+gameObject.name); UIManager.UICamera = camera2D; gm = GameManager.Instance; gm.mainGame = this; gm.debugMode = debug; gm.standaloneBetaMode = standaloneBeta; gm.standaloneSingleLevelMode = standaloneSingleLevel; gm.BalanceSheetAchievementMode = true; gm.muteSfx = muteSfx; if(gm.setTouch) gm.hidTouch = hidTouch; else hidTouch = gm.hidTouch; gm.muteSoundBackground = muteSoundBackground; //localisation i18n = I18nManager.Instance; i18n.LoadDbFile(localizatoinDB); if(i18n.Language == null || i18n.Language.Length == 0) { //first time set string lang = ""; switch(language) { case Languages.DE: lang = "DE"; break; case Languages.DEP: lang = "DEP"; break; case Languages.EN: lang = "EN"; break; case Languages.NL: lang = "NL"; break; } i18n.Language = lang; } else { //lang has already been set, //but better to set local game's language to avoid confusion switch(i18n.Language) { case "DE": language = Languages.DE; break; case "DEP": language = Languages.DEP; break; case "EN": language = Languages.EN; break; case "NL": language = Languages.NL; break; } I18nManager.Instance.SetLanguage(i18n.Language); } //Audio using localization db am = AudioManager.Instance; am.InitAudio(); try { // Log.Debug("---------- am:"+am); Log.Debug("---------- audioResources:"+audioResources); am.LoadResources("AUDIO", audioResources); am.MuteMusic = muteSoundBackground; am.MuteSfx = muteSfx; } catch { //TODO only hide when in editor mode //we hide error for now due to editor Log.Error("---------- audioResources:"+audioResources); } // DialogGame can be seen as a MainGame and a requirement GMGame game = new GMGame(this.name); gm.Add(game); gm.DialogGame = game; }
//------------------------------------------------------------------------------ ///<summary> /// ///</summary> void Awake() { Log.Debug(gameObject.name+" AWAKEN"); //get managers uiManager = UIManager.Instance; gpm = GameManager.Instance; //TODO dynamic creation from file if (mainMenu == null) LogCyan("mainMenu", gameObject.name); if (buildMenu == null) LogCyan("buildMenu", gameObject.name); if (txtBuildMenu == null) LogCyan("txtBuildMenu", gameObject.name); if (financeMenu == null) LogCyan("financeMenu", gameObject.name); if (txtFinanceMenu == null) LogCyan("txtFinanceMenu", gameObject.name); if (staticsMenu == null) LogCyan("staticsMenu", gameObject.name); if (txtStaticsMenu == null) LogCyan("txtStaticsMenu", gameObject.name); if (buildButton == null) LogCyan("buildButton", gameObject.name); if (financeButton == null) LogCyan("financeButton", gameObject.name); if (statisticsButton == null) LogCyan("statisticsButton", gameObject.name); if (cursorIcon_Pipe == null) LogCyan("cursorIcon_Pipe", gameObject.name); if (cursorIcon_Filter == null) LogCyan("cursorIcon_Filter", gameObject.name); if (btnMap == null) LogCyan("btnMap", gameObject.name); txtBuildMenu.Text = I18nManager.Instance.Get("POPUP_BUTTON", "004"); txtFinanceMenu.Text = I18nManager.Instance.Get("POPUP_BUTTON", "005"); txtStaticsMenu.Text = I18nManager.Instance.Get("POPUP_BUTTON", "006"); }
/// <summary> /// Create the text and set the tail on bubble /// </summary> void Awake() { //create text component origScale = gameObject.transform.localScale; tailNames = new string[] {"tail_E", "tail_N", "tail_NE", "tail_NW", "tail_S", "tail_SE", "tail_SW", "tail_W"}; tails = new GameObject[8]; for(int i = 0; i < tailNames.Length; i++) { string objname = gameObject.name + "/tails/" + tailNames[i]; tails[i] = GameObject.Find(objname); Log.Assert(tails[i], "Cannot find tail:"+objname); } //save original size scale = origScale; string path = (gameObject.transform.parent != null) ? gameObject.transform.parent.name + "/" + gameObject.name : gameObject.name; bubbleObj = GameObject.Find(path+"/bubble_scale/bubble_text"); bubbleOutline = GameObject.Find(path+"/bubble_scale/bubble_outline"); nameGroup = GameObject.Find(path+"/name_group"); nameObj = GameObject.Find(path+"/name_group/name_text"); nameOutline = GameObject.Find(path+"/name_group/name_outline"); Log.Assert(bubbleObj, "Missing BubbleObject in "+ path); Log.Assert(bubbleOutline, "Missing bubbleOutline in "+ gameObject.name); Log.Assert(nameGroup, "Missing nameGroup in "+ gameObject.name); Log.Assert(nameObj, "Missing nameObj in "+ gameObject.name); Log.Assert(nameOutline, "Missing nameOutline in "+ gameObject.name); GameObject obj; obj = GameObject.Find(path + "/Text"); if(obj != null) { //Log.Assert(obj, "Missing Text object in "+path); bubbleText = obj.GetComponent<UIText>(); Log.Assert(bubbleText, "Cannot find text in bubble " + obj.name); bubbleText.isLocalized = false; //bubbleText.wrapSize = 30; } else { Log.Error("OOPS1"+path+"/Text"); } //grab name obj = GameObject.Find(path + "/name_group/Text"); if(obj != null) { nameText = obj.GetComponent<UIText>(); Log.Assert(nameText, "Cannot find name in bubble " + obj.name); } //grab debugText obj = GameObject.Find(path + "/DebugText"); if(obj != null) { //Log.Assert(obj, "Missing Text object in "+path); debugText = obj.GetComponent<UIText>(); Log.Assert(debugText, "Cannot find text in bubble " + obj.name); debugText.isLocalized = false; //debugText.Text = ""; } //get managers uiManager = UIManager.Instance; gpm = GameManager.Instance; }//Awake()
//------------------------------------------------------------------------------ ///<summary> /// ///</summary> void Awake() { Log.Debug(gameObject.name+" AWAKEN"); //get managers uiManager = UIManager.Instance; gpm = GameManager.Instance; //financeManager = F0000_FinanceManager.Instance; //TODO dynamic creation from file //if (mainMenu == null) LogCyan("mainMenu", gameObject.name); hudOpen = false; }//Awake()
//-------------------------------- basic unity API MonoBehavior class methods ----- /// <summary> /// Initialization, read childe gameobject /// and set the buttons to it's uitext components /// </summary> void Awake() { // Log.Info("Awake:" + gameObject.name); Reset(); GameObject obj; popup = GameObject.Find(gameObject.name+"popup_MultipleChoice"); // Log.Assert(popup, "Missing popup_MultipleChoice in "+gameObject.name); obj = GameObject.Find(gameObject.name+ "popup_MultipleChoice/btn_MultipleChoice_Answer_Positive/Text"); // Log.Assert(obj, "Missing Positive button in "+gameObject.name); positiveText = obj.GetComponent<UIText>(); // Log.Assert(positiveText, "Missing positiveText UIText component!"); obj = GameObject.Find(gameObject.name+"popup_MultipleChoice/btn_MultipleChoice_Answer_Negative/Text"); // Log.Assert(obj, "Missing Negative button in MultipleChoice popup!"); negativeText = obj.GetComponent<UIText>(); // Log.Assert(negativeText, "Missing negativeText UIText component!"); obj = GameObject.Find(gameObject.name+"popup_MultipleChoice/btn_MultipleChoice_Answer_Neutral/Text"); // Log.Assert(obj, "Missing Neutral button in MultipleChoice popup!"); neutralText = obj.GetComponent<UIText>(); // Log.Assert(neutralText, "Missing neutralText UIText component!"); multichoicePositions = new Vector3[3]; obj = GameObject.Find(gameObject.name+"popup_MultipleChoice/btn_MultipleChoice_Answer_Neutral"); neutralButton = obj.GetComponent<Button>(); multichoicePositions[0] = neutralButton.transform.position; obj = GameObject.Find(gameObject.name+"popup_MultipleChoice/btn_MultipleChoice_Answer_Negative"); negativeButton = obj.GetComponent<Button>(); multichoicePositions[1] = negativeButton.transform.position; obj = GameObject.Find(gameObject.name+"popup_MultipleChoice/btn_MultipleChoice_Answer_Positive"); positiveButton = obj.GetComponent<Button>(); multichoicePositions[2] = positiveButton.transform.position; bubbles = new Dictionary<string, SpeechBubble>(); ui = UIManager.Instance; gpm = GameManager.Instance; //create temp container for dynamic bubbles tmpContainer = new GameObject(); tmpContainer.name = "bubbles"; tmpContainer.transform.parent = gameObject.transform; ActivateAll(false); }