/// <summary> /// Adds the selection. /// </summary> /// <returns> /// The selection. /// </returns> /// <param name='title'> /// Title. /// </param> /// <param name='target'> /// Target. /// </param> public override GameObject AddSelection(string title, string target) { GameObject selection = m_SelectionCache[m_CurrSelectIndex]; m_CurrSelectIndex++; if (m_CurrSelectIndex > base._SELECTION_CACHE_NUM) { ViNoDebugger.LogError("selection index range error."); } GUISelection guiSel = selection.GetComponent <GUISelection>(); guiSel.SetGUIDiglogCtrl(this); guiSel.text = title; float posY = Screen.height / 2f; float w = Screen.width / 4f; float h = 50f; posY += +(m_CurrSelectIndex - 1) * (kOffsetY + kLineSpaceY); Vector2 pos = initialPos; pos += new Vector2(Screen.width / 2f - w / 2f, posY); guiSel.SetPosition(pos, w, h); m_SelectionDict.Add(selection.name, new SelectionUnit(title, target)); // Now , Show Selection. selection.SetActive(true); return(selection); }
public void Action() { GUISelection c = container; if (c != null) { c.Select(this); } }