void Start() { Log.Assert(popupSettings, "Please assign the popup in "+gameObject.name); Log.Assert(txtVersion, "Please assign the txtVersion in "+gameObject.name); Log.Assert(btnClose, "Please assign the btnClose in "+gameObject.name); GameObject obj = null; popupSettings = GetChildObject("popup"); obj = GetChildObject("popup/txt_Copyright_Content2"); txtVersion = obj.GetComponent<UIText>(); txtVersion.text = "Version: "+GameObject.Find("TWISTBueBe").GetComponent<TWISTBueBe.TWISTGame>().buildTime; obj = GetChildObject("popup/btn_Close"); btnClose = obj.GetComponent<Button>(); obj = GetChildObject("popup/btn_Close/Text"); UIText btnCloseText = obj.GetComponent<UIText>(); btnCloseText.Text = I18nManager.Instance.Get("POPUP_BUTTON", "003"); Hide(); }
/// <summary> /// set up basic components /// </summary> void Awake() { Log.Assert(txtMessage, "Please assign the txtMessage in "+gameObject.name); Log.Assert(popup, "Please assign the popup in "+gameObject.name); uiManager = UIManager.Instance; i18n = I18nManager.Instance; decisionPopup = DecisionPopups.Instance; GameObject obj = null; popup = GetChildObject("popup"); obj = GetChildObject("popup/txt_Message"); txtMessage = obj.GetComponent<UIText>(); obj = GetChildObject("popup/btn_Yes"); btnYes = obj.GetComponent<Button>(); obj = GetChildObject("popup/btn_Yes/Text"); UIText btnYesText = obj.GetComponent<UIText>(); btnYesText.Text = I18nManager.Instance.Get("POPUP_BUTTON", "001"); obj = GetChildObject("popup/btn_No"); btnNo = obj.GetComponent<Button>(); obj = GetChildObject("popup/btn_No/Text"); UIText btnNoText = obj.GetComponent<UIText>(); btnNoText.Text = I18nManager.Instance.Get("POPUP_BUTTON", "002"); id = "001"; Hide(); GameManager.Instance.RegisterEventHandler("POPUP_DECISION", EventHandler); }
//-------------------------------- 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); }
//------------------------------------------------------------------------------ /// <summary> /// Initialize the components /// </summary> public virtual void Awake() { //Debug.Log ("AchievementsLogs Awake"); GameObject obj = null; uiManager = UIManager.Instance; hud = GetChildObject("HUD"); logPanel = GetChildObject("HUD/popup_Achievements"); obj = GetChildObject("HUD/popup_Achievements/txt_Note"); logText = obj.GetComponent<UIText>(); logText.wrapSize = 40; obj = GetChildObject("HUD/popup_Achievements/txt_Time"); logTime = obj.GetComponent<UIText>(); //use Slots class here? slots = new List<AchievementNpc>(); slots.Add(GetChildObject(gBadge+"1").GetComponent<AchievementNpc>()); slots.Add(GetChildObject(gBadge+"2").GetComponent<AchievementNpc>()); slots.Add(GetChildObject(gBadge+"3").GetComponent<AchievementNpc>()); slots.Add(GetChildObject(gBadge+"4").GetComponent<AchievementNpc>()); obj = GetChildObject ("HUD/btn_Arrow_Achievements_left"); leftArrow = obj.GetComponent<Button> (); obj = GetChildObject ("HUD/btn_Arrow_Achievements_right"); rightArrow = obj.GetComponent<Button> (); logs = Achievements.Instance; activeSlot = -1; logPages = 0; activePage = 0; //TODO : The GameManager.Remove(EventHandler); is missing // Where to set? // As the AchievementsLog is only once set in a game it should // not be a serious issue GameManager.Instance.RegisterEventHandler( "ACHIEVEMENT", ProcessAchievementEvent, gameObject); Show(false); achievementSprite = UIManager.LoadSprite ( "Game/Sprites/Achievement/badge_Achievements"); ResetSlots (0); }
/// <summary> /// Initializa main components /// </summary> void Awake() { Log.Assert(popup, "Please assign the popup in "+gameObject.name); Log.Assert(txtMessage, "Please assign the txtMessage in "+gameObject.name); Log.Assert(btnOk, "Please assign the btnOk in "+gameObject.name); uiManager = UIManager.Instance; i18n = I18nManager.Instance; messagePopup = MessagePopups.Instance; GameObject obj = null; popup = GetChildObject("popup"); obj = GetChildObject("popup/txt_Message"); txtMessage = obj.GetComponent<UIText>(); obj = GetChildObject("popup/btnOk"); btnOk = obj.GetComponent<Button>(); obj = GetChildObject("popup/btnOk/txt_btnOk"); txtbtnOk = obj.GetComponent<UIText>(); txtbtnOk.Text = I18nManager.Instance.Get("POPUP_BUTTON", "0031"); id = "001"; Hide(); GameManager.Instance.RegisterEventHandler("POPUP_MESSAGE", EventHandler, gameObject); }