public void PageDeActivatedHandler() { ObjPoolManager.RefreshPool(); pageActivatedBefore = false; //delete the buffer game objects for (int i = 0; i < transform.childCount; i++) { try { if (scroll.content.GetChild(i).name.Contains("UI_Buffer")) { Destroy(scroll.content.GetChild(i).gameObject); } } catch (Exception e) { if (e.GetType() == typeof(NullReferenceException)) { } } } transform.Find("ScrollMenuLoadCover").gameObject.SetActive(true); }
void OnInitialize() { LuaManager.InitStart(); LuaManager.DoFile("Logic/Game"); //加载游戏 LuaManager.DoFile("Logic/Network"); //加载网络 NetManager.OnInit(); //初始化网络 Util.CallMethod("Game", "OnInitOK"); //初始化完成 initialize = true; //类对象池测试 // var classObjPool = ObjPoolManager.CreatePool<TestObjectClass>(OnPoolGetElement, OnPoolPushElement); //方法1 //objPool.Release(new TestObjectClass("abcd", 100, 200f)); //var testObj1 = objPool.Get(); //方法2 // ObjPoolManager.Release<TestObjectClass>(new TestObjectClass("abcd", 100, 200f)); // var testObj1 = ObjPoolManager.Get<TestObjectClass>(); //游戏对象池测试 var prefab = Resources.Load("TestGameObjectPrefab", typeof(GameObject)) as GameObject; var gameObjPool = ObjPoolManager.CreatePool("TestGameObject", 5, 10, prefab); var gameObj = Instantiate(prefab) as GameObject; gameObj.name = "TestGameObject_01"; gameObj.transform.localScale = Vector3.one; gameObj.transform.localPosition = Vector3.zero; ObjPoolManager.Release("TestGameObject", gameObj); var backObj = ObjPoolManager.Get("TestGameObject"); backObj.transform.SetParent(null); Debug.Log("TestGameObject--->>>" + backObj); }
void TestObject() { //类对象池测试 var classObjPool = ObjPoolManager.CreatePool <TestObjectClass>(OnPoolGetElement, OnPoolPushElement); //方法1 //objPool.Release(new TestObjectClass("abcd", 100, 200f)); //var testObj1 = objPool.Get(); //方法2 ObjPoolManager.Release <TestObjectClass>(new TestObjectClass("abcd", 100, 200f)); var testObj1 = ObjPoolManager.Get <TestObjectClass>(); Debugger.Log("TestObjectClass--->>>" + testObj1.ToString()); //游戏对象池测试 var prefab = Resources.Load("TestGameObjectPrefab", typeof(GameObject)) as GameObject; var gameObjPool = ObjPoolManager.CreatePool("TestGameObject", 5, 10, prefab); var gameObj = Instantiate(prefab) as GameObject; gameObj.name = "TestGameObject_01"; gameObj.transform.localScale = Vector3.one; gameObj.transform.localPosition = Vector3.zero; ObjPoolManager.Release("TestGameObject", gameObj); var backObj = ObjPoolManager.Get("TestGameObject"); backObj.transform.SetParent(null); Debug.Log("TestGameObject--->>>" + backObj); }
//The implementation of the page generator for this pages submenu public override void MakeLinkedPages() { if (OrderedByName == null) { Debug.LogWarning("Warning: There was no list to iterate through"); return; } var BiographyOrderedByName = (System.Linq.IOrderedEnumerable <Biography>)OrderedByName; foreach (Biography bioJson in BiographyOrderedByName) { Name_Suffix = bioJson.Name.Replace(" ", ""); GameObject go = null; ObjPoolManager.RetrieveFromPool(ObjPoolManager.Pool.Bio, ref go); if (go != null) { go.transform.SetParent(Page_Parent.transform); go.name = (Name_Suffix + "_Page"); Bio_Page bp = go.GetComponent <Bio_Page>(); if (bp.Name.text != bioJson.Name) { bp.SetName(bioJson.Name); bp.SetTitle(bioJson.Title); bp.SetImageFromAssetBundle(bioJson.Name.Replace(" ", "_").ToLower(), "hld/bios/photos"); bp.SetDesc(bioJson.Bio); } } } StartCoroutine(GetComponent <UIB_Page>().ResetUAP(true)); }
/// <summary> /// 资源初始化结束 /// </summary> public void OnResourceInited() { LuaManager.InitStart(); LuaManager.DoFile("Logic/Game"); //加载游戏 LuaManager.DoFile("Logic/Network"); //加载网络 NetManager.OnInit(); //初始化网络 Util.CallMethod("Game", "OnInitOK"); //初始化完成 initialize = true; //初始化完 //类对象池测试 var classObjPool = ObjPoolManager.CreatePool <TestObjectClass>(OnPoolGetElement, OnPoolPushElement); //方法1 //objPool.Release(new TestObjectClass("abcd", 100, 200f)); //var testObj1 = objPool.Get(); //方法2 ObjPoolManager.Release <TestObjectClass>(new TestObjectClass("abcd", 100, 200f)); var testObj1 = ObjPoolManager.Get <TestObjectClass>(); Debugger.Log("TestObjectClass--->>>" + testObj1.ToString()); //游戏对象池测试 var prefab = Resources.Load("TestGameObjectPrefab", typeof(GameObject)) as GameObject; var gameObjPool = ObjPoolManager.CreatePool("TestGameObject", 5, 10, prefab); var gameObj = Instantiate(prefab) as GameObject; gameObj.name = "TestGameObject_01"; gameObj.transform.localScale = Vector3.one; gameObj.transform.localPosition = Vector3.zero; ObjPoolManager.Release("TestGameObject", gameObj); var backObj = ObjPoolManager.Get("TestGameObject"); backObj.transform.SetParent(null); Debug.Log("TestGameObject--->>>" + backObj); PoolManager.Instance.Get("TestGameObjectPrefab", "TestGameObjectPrefab", new Action <UnityEngine.Object>(LoadComplite)); PoolManager.Instance.Get("TestGameObjectPrefab", "TestGameObjectPrefab", new Action <UnityEngine.Object>(LoadComplite1)); PoolManager.Instance.Get("TestGameObjectPrefab", "TestGameObjectPrefab", new Action <UnityEngine.Object>(LoadComplite2)); PoolManager.Instance.Get("TestGameObjectPrefab", "TestGameObjectPrefab", new Action <UnityEngine.Object>(LoadComplite3)); PoolManager.Instance.Get("TestGameObjectPrefab", "TestGameObjectPrefab", new Action <UnityEngine.Object>(LoadComplite4)); PoolManager.Instance.Get("TestGameObjectPrefab", "TestGameObjectPrefab", new Action <UnityEngine.Object>(LoadComplite5)); /* PoolManager.Instance.Get("TestGameObjectPrefab","TestGameObjectPrefab",(obj)=>{ * GameObject temp = obj as GameObject; * * }); */ }
public void Awake() { if (_instance != null && _instance != this) { // if obj is a duplicate, destroy it Destroy(gameObject); return; } else { _instance = this; } }
void OnInitialize() { LuaManager.InitStart(); LuaManager.DoFile("Logic/Game"); //加载游戏 LuaManager.DoFile("Logic/Network"); //加载网络 NetManager.OnInit(); //初始化网络 Util.CallMethod("Game", "OnInitOK"); //初始化完成 initialize = true; //类对象池测试 ObjPoolManager.CreatePool <TestObjectClass>(OnPoolGetElement, OnPoolPushElement); //方法1 //objPool.Release(new TestObjectClass("abcd", 100, 200f)); //var testObj1 = objPool.Get(); //方法2 ObjPoolManager.Release <TestObjectClass>(new TestObjectClass("abcd", 100, 200f)); var testObj1 = ObjPoolManager.Get <TestObjectClass>(); LogManager.Debug("TestObjectClass--->>>" + testObj1.ToString()); //cube //ResManager.LoadPrefab("prefabs.unity3d", new string[] { "Cube" }, null); var prefab = LoadPrefab("prefabs.unity3d", "Cube") as GameObject; ObjPoolManager.CreatePool("Cube", 5, 10, prefab); //Particle //ResManager.LoadPrefab("prefabs.unity3d", new string[] { "Particle" }, null); prefab = LoadPrefab("prefabs.unity3d", "CircleParticle") as GameObject; ObjPoolManager.CreatePool("CircleParticle", 1, 1, prefab); //游戏对象池测试 //var prefab = Resources.Load("TestGameObjectPrefab", typeof(GameObject)) as GameObject; //var gameObj = Instantiate(prefab) as GameObject; //gameObj.name = "TestGameObject_01"; //gameObj.transform.localScale = Vector3.one; //gameObj.transform.localPosition = Vector3.zero; //ObjPoolManager.Release("TestGameObject", gameObj); //var backObj = ObjPoolManager.Get("TestGameObject"); //if (backObj != null) //{ // backObj.transform.SetParent(null); //} //LogManager.Debug("TestGameObject--->>>" + backObj); }
public void UpdateTransformData(ObjPoolManager pool) { var rootPool = pool.rootPool; var rolePool = pool.rolePool; for (int i = 0; i < rootPool.Length; i++) { if (rootPool[i] != null && rolePool[i] != null) { Data.roles[i].rootPos = rootPool[i].transform.position; Data.roles[i].rolePos = rolePool[i].transform.position; Data.roles[i].roleRot = rolePool[i].transform.rotation; } } }
void OnInitialize() { LuaManager.InitStart(); LuaManager.DoFile("Logic/Game"); //加载游戏 LuaManager.DoFile("Logic/Network"); //加载网络 LuaManager.DoFile("Logic/ObjectPool"); NetManager.OnInit(); //初始化网络 ObjPoolManager.OnInit(); //初始化对象池 Util.CallMethod("Game", "OnInitOK", isReload); //初始化完成 initialize = true; //RenderTexture tex = new RenderTexture(128, 128, 1, RenderTextureFormat.ARGB32); //Texture2D texture2D = new Texture2D(256, 256); //texture2D.ReadPixels() //Sprite sprite = Sprite.Create(tx, new Rect(0, 0, tex.width, tex.height), new Vector2(0.5f, 0.5f)); //类对象池测试 // var classObjPool = ObjPoolManager.CreatePool<TestObjectClass>(OnPoolGetElement, OnPoolPushElement); //方法1 //objPool.Release(new TestObjectClass("abcd", 100, 200f)); //var testObj1 = objPool.Get(); //方法2 //ObjPoolManager.Release<TestObjectClass>(new TestObjectClass("abcd", 100, 200f)); //var testObj1 = ObjPoolManager.Get<TestObjectClass>(); //Debugger.Log("TestObjectClass--->>>" + testObj1.ToString()); //游戏对象池测试 //var prefab = Resources.Load("TestGameObjectPrefab", typeof(GameObject)) as GameObject; //var gameObjPool = ObjPoolManager.CreatePool("TestGameObject", 5, 10, prefab); //var gameObj = Instantiate(prefab) as GameObject; //gameObj.name = "TestGameObject_01"; //gameObj.transform.localScale = Vector3.one; //gameObj.transform.localPosition = Vector3.zero; //ObjPoolManager.Release("TestGameObject", gameObj); //var backObj = ObjPoolManager.Get("TestGameObject"); //backObj.transform.SetParent(null); //Debug.Log("TestGameObject--->>>" + backObj); }
//The implementation of the page generator for this pages submenu public override void MakeLinkedPages() { // Debug.Log(gameObject.name + " " +"makelinkedpages"); var ShowName = name.Split('-')[0]; if (ShowName == "CompanyDancers_Page") { var BiographyOrderedByName = (System.Linq.IOrderedEnumerable <Biography>)OrderedByName; foreach (Biography bioJson in BiographyOrderedByName) { Name_Suffix = bioJson.Name.Replace(" ", ""); GameObject go = null; ObjPoolManager.RetrieveFromPool(ObjPoolManager.Pool.Narrative, ref go); if (go != null) { go.transform.SetParent(Page_Parent.transform); go.name = (Name_Suffix + "_Page"); Narrative_Page np = go.GetComponent <Narrative_Page>(); np.SetupPage(bioJson.Name, bioJson.Name.Replace(" ", "_").ToLower()); np.SetShowName(name.Split('-')[0]); } } } else { foreach (string s in listOfDancers) { Name_Suffix = s.Replace("_", ""); GameObject go = null; ObjPoolManager.RetrieveFromPool(ObjPoolManager.Pool.Narrative, ref go); if (go != null) { go.transform.SetParent(Page_Parent.transform); go.name = (Name_Suffix + "_Page"); Narrative_Page np = go.GetComponent <Narrative_Page>(); // Debug.Log("s:" + s.Replace("_","_").ToLower()); np.SetupPage(s, s.Replace("_", "_").ToLower()); np.SetShowName(name.Split('-')[0]); } } } }
void OnInitialize() { LuaManager.InitStart(); NetManager.OnInit(); //初始化网络 initialize = true; //类对象池测试 var classObjPool = ObjPoolManager.CreatePool <TestObjectClass>(OnPoolGetElement, OnPoolPushElement); //方法1 //objPool.Release(new TestObjectClass("abcd", 100, 200f)); //var testObj1 = objPool.Get(); //方法2 ObjPoolManager.Release <TestObjectClass>(new TestObjectClass("abcd", 100, 200f)); var testObj1 = ObjPoolManager.Get <TestObjectClass>(); Log.Info("TestObjectClass--->>>" + testObj1.ToString()); //游戏对象池测试 var prefab = Resources.Load("TestGameObjectPrefab", typeof(GameObject)) as GameObject; var gameObjPool = ObjPoolManager.CreatePool("TestGameObject", 5, 10, prefab); var gameObj = Instantiate(prefab) as GameObject; gameObj.name = "TestGameObject_01"; gameObj.transform.localScale = Vector3.one; gameObj.transform.localPosition = Vector3.zero; ObjPoolManager.Release("TestGameObject", gameObj); var backObj = ObjPoolManager.Get("TestGameObject"); backObj.transform.SetParent(null); Log.Info("TestGameObject--->>>" + backObj); PanelManager.CreatePanel("Prompt", delegate(GameObject go) { Log.Info("Prompt created"); }); }
void Start() { _config = FindObjectOfType <Config>(); _pool = FindObjectOfType <ObjPoolManager>(); GetSystemInfo(); if (!Application.isEditor) { Application.targetFrameRate = 60; LoadIconFile(Application.persistentDataPath); SetWindowStyle(); AddSystemTray(); StartCoroutine("AutoUpdate"); } InitRole(); }
IEnumerator Init() { //set T1 for timing Init; t1 = Time.time; // Disable screen dimming Screen.sleepTimeout = SleepTimeout.NeverSleep; UIB_PlatformManager.Init(); try { UAP_AccessibilityManager.PauseAccessibility(true); } catch (Exception e) { if (e.GetType() == typeof(NullReferenceException)) { } } //this player pref should get set at app launch so that it resets the timecode in the audio-desc; PlayerPrefs.SetInt("desc_timecode", 0); try { percentText = GameObject.Find("DownloadPercent").GetComponent <TextMeshProUGUI>(); } catch (Exception e) { Debug.Log("Failed to find GameObject: " + e); yield break; } try { db_Manager = GameObject.Find("DB_Manager").GetComponent <HLD.Database_Accessor>(); } catch (Exception e) { Debug.Log("No database manager" + e); yield break; } db_Manager.Init(); try { blankPage = GameObject.Find("BlankPage"); } catch (Exception e) { Debug.Log("No blankpage " + e); yield break; } try { aspectManager = GameObject.FindGameObjectWithTag("MainCanvas"); } catch (Exception e) { Debug.Log("no aspect ratio manager " + e); yield break; } try { AccessibilityInstructions = GameObject.Find("AccessibleInstructions_Button"); } catch (Exception e) { Debug.Log("no instructions " + e); yield break; } //this coroutine checks the local files and starts any necessary downloads StartCoroutine("CheckLocalFiles"); //this coroutine continously checks if we have wifi and downloads are happening //it updates the download icon accordingly StartCoroutine("CheckWifiAndDownloads"); //this coroutine updates download percentage over time StartCoroutine("UpdateDownloadPercent"); //this coroutine waits until we have checked for all the files //then it begins loading asset bundles in the background //it must be started after pages have initialized StartCoroutine("ManageAssetBundleFiles"); //setup checks for accessibility on android - which is wierd; #if UNITY_ANDROID && !UNITY_EDITOR Debug.Log("checking accessibility " + UAP_AccessibilityManager.GetAndroidAccessibility()); if (UAP_AccessibilityManager.GetAndroidAccessibility()) { Debug.Log("Accessibility ON"); UAP_AccessibilityManager.EnableAccessibility(true); } else { Debug.Log("Accessibility OFF"); UAP_AccessibilityManager.EnableAccessibility(false); } #endif //Set the main page container //Can't remember why i did this UIB_PageContainer MainContainer = null; foreach (UIB_PageContainer PageContainer in GetComponentsInChildren <UIB_PageContainer>()) { MainContainer = PageContainer; MainContainer.Init(); } //set scroll rects to top foreach (Scrollbar sb in GetComponentsInChildren <Scrollbar>()) { sb.value = 1; } //turn aspect ratio fitters on //causes all pages to share origin with canvas and be correct dimensions foreach (AspectRatioFitter arf in GetComponentsInChildren <AspectRatioFitter>()) { arf.aspectRatio = (UIB_AspectRatioManager.ScreenWidth) / (UIB_AspectRatioManager.ScreenHeight); arf.aspectMode = AspectRatioFitter.AspectMode.FitInParent; arf.enabled = true; } //initialize each button foreach (UI_Builder.UIB_Button ab in GetComponentsInChildren <UI_Builder.UIB_Button>()) { //before initializing buttons, we may change some names based on player_prefs if (ab.name == "Displayed-Code_Button") { CheckAndUpdateLinks("Displayed-Info_Page"); } if (ab.name == "OnDisplay-Code_Button") { CheckAndUpdateLinks("OnDisplay-Info_Page"); } if (ab.name == "Unfinished-Code_Button") { CheckAndUpdateLinks("Unfinished-Info_Page"); } if (ab.name == "SoloFlight-Code_Button") { CheckAndUpdateLinks("SoloFlight-Info_Page"); } ab.Init(); } //initialize objects in the object pools //todo:tag this for eventual replacement with better pages/buttons ObjPoolManager.Init(); ObjPoolManager.RefreshPool(); //initialize each page foreach (UIB_IPage p in GetComponentsInChildren <UIB_IPage>()) { p.Init(); } //initialize companty dancers page //TODO: might not need this foreach (CompanyDancers_Page p in GetComponentsInChildren <CompanyDancers_Page>()) { p.Init(); } foreach (UIB_Page p in GetComponentsInChildren <UIB_Page>()) { //TODO:Fix this bad bad shit if (p.gameObject.name == "Landing_Page") { yield return(p.MoveScreenOut(true)); } else { p.StartCoroutine("MoveScreenOut", true); } } //initialize each scrolling menu foreach (UIB_ScrollingMenu uibSM in GetComponentsInChildren <UIB_ScrollingMenu>()) { uibSM.Init(); } //setup the first screen var firstScreen = GameObject.Find("Landing_Page"); yield return(firstScreen.GetComponent <UIB_Page>().StartCoroutine("MoveScreenIn", true)); if (UAP_AccessibilityManager.IsEnabled()) { //unpause accessibility manger to read first button UAP_AccessibilityManager.PauseAccessibility(false); if (UAP_AccessibilityManager.IsActive()) { // AccessibilityInstructions.SetActive(true); } else { } //select the first button with UAP var first = GameObject.Find("DISPLAYED-Code_Button"); UAP_AccessibilityManager.SelectElement(first, true);; } //remove the cover MainContainer.DisableCover(); //if we finish initializing faster than expected, take a moment to finish the video t2 = Time.time; var elapsed = t2 - t1; if (InitializeTime > elapsed) { yield return(new WaitForSeconds(InitializeTime - elapsed)); } else if (Mathf.Approximately(InitializeTime, float.Epsilon)) { Debug.Log("took " + elapsed + "s to initialize"); } else { Debug.LogWarning("Took longer to initialize than expected"); } yield break; }
private void Start() { _pool = FindObjectOfType <ObjPoolManager>(); _window = FindObjectOfType <TransparentWindow>(); _camera = Camera.main.gameObject; }
/* * //THIS IS THE OLD PAGEACTIVEDHANDLER THAT USED THE VIDEO PLAYER * public void PageActivatedHandler() * { * if (GetComponent<UIB_Page>().AssetBundleRequired) { * Debug.Log("we need an asset bundle for this page"); * } * * GameObject.FindWithTag("App_VideoPlayer").GetComponent<UIB_VideoPlayer>().OriginScreen = gameObject; * * //sort alphabetically * var OrderedByName = Dancers.OrderBy(x => x); * * int i = 0; * ObjPoolManager.BeginRetrieval(); * * foreach (string dancer in OrderedByName) * { * GameObject b = null; * ObjPoolManager.RetrieveFromPool(ObjPoolManager.Pool.Button, ref b); * * if (b != null) * { * b.name = dancer.Replace(" ", "_") + " video"; * * b.GetComponent<UnityEngine.UI.Button>().onClick.AddListener(delegate { PlayVideoFromAssetBundle(dancer, "hld/meondisplay/"); }); * b.transform.SetParent(scroll.content.transform); * * var ab = b.GetComponent<UI_Builder.UIB_Button>(); * ab.SetButtonText(dancer); * ab.Button_Opens = UI_Builder.UIB_Button.UIB_Button_Activates.Video; * * ab.Init(); * * var sab = b.GetComponent<Special_AccessibleButton>(); * if (i == 0) * { * AccessibleButton = sab; * } * * sab.m_ManualPositionOrder = i; * sab.m_ManualPositionParent = transform.parent.gameObject; * * i++; * } * else * Debug.LogError("Not enough objects in pool"); * } * ObjPoolManager.EndRetrieval(); * * var theScroll = transform.Find("UIB_ScrollingMenu"); * theScroll.GetComponent<UIB_ScrollingMenu>().playedOnce=false; * theScroll.GetComponent<UIB_ScrollingMenu>().Setup(); * * GameObject.FindWithTag("App_VideoPlayer").GetComponent<UIB_Page>().DeActivate(); * * StartCoroutine(GetComponent<UIB_Page>().ResetUAP(true)); * } */ //THIS IS THE NEW PAGE ACTIVASTED HANDLER //THIS ONE ADDS A BUTTON THAT OPENS A PAGE LINK TO THE VIDEO. public void PageActivatedHandler() { scroll.content.GetComponent <RectTransform>().pivot = new Vector2(0, 1); if (GetComponent <UIB_Page>().AssetBundleRequired) { Debug.Log("we need an asset bundle for this page"); } GameObject.FindWithTag("App_VideoPlayer").GetComponent <UIB_VideoPlayer>().OriginScreen = gameObject; //sort alphabetically var OrderedByName = Dancers.OrderBy(x => x.Split(' ')[1]); int i = 0; foreach (string dancer in OrderedByName) { GameObject b = null; ObjPoolManager.RetrieveFromPool(ObjPoolManager.Pool.Button, ref b); if (b != null) { b.name = dancer.Replace(" ", "_") + " video"; //b.GetComponent<UnityEngine.UI.Button>().onClick.AddListener(delegate { PlayVideoFromAssetBundle(dancer, "hld/meondisplay/"); }); b.transform.SetParent(scroll.content.transform); var ab = b.GetComponent <UIB_Button>(); ab.SetButtonText(dancer); ab.Button_Opens = UIB_Button.UIB_Button_Activates.InAppUrl; ab.s_link = DancerLinks[i]; ab.Init(); var sab = b.GetComponent <Special_AccessibleButton>(); if (i == 0) { AccessibleButton = sab; } sab.m_ManualPositionOrder = i; sab.m_ManualPositionParent = transform.parent.gameObject; i++; } else { Debug.LogError("Not enough objects in pool"); } } var theScroll = transform.Find("UIB_ScrollingMenu"); theScroll.GetComponent <UIB_ScrollingMenu>().playedOnce = false; theScroll.GetComponent <UIB_ScrollingMenu>().Setup(); GameObject.FindWithTag("App_VideoPlayer").GetComponent <UIB_Page>().DeActivate(); StartCoroutine(GetComponent <UIB_Page>().ResetUAP(true)); }
public void PageDeActivatedHandler() { //Return the objecst to the pool ObjPoolManager.RefreshPool(); }
void Start() { cl_ObjPoolManager = this; // ----- SCOUTS ----- // //Bullets list for Scout1 Gun1 go_bulletListS1Gun1 = new List <GameObject>(); bulletContainerS1Gun1 = GameObject.Find("scout1Ammo/gun1"); for (int i = 0; i < 50; i++) { GameObject temp = Instantiate(bulletRef); temp.SetActive(false); go_bulletListS1Gun1.Add(temp); go_bulletListS1Gun1[i].transform.parent = bulletContainerS1Gun1.transform; go_bulletListS1Gun1[i].transform.position = bulletContainerS1Gun1.transform.position; go_bulletListS1Gun1[i].name = "bulletSC1"; } //Bullets list for Scout1 Gun2 go_bulletListS1Gun2 = new List <GameObject>(); bulletContainerS1Gun2 = GameObject.Find("scout1Ammo/gun2"); for (int i = 0; i < 50; i++) { GameObject temp = Instantiate(bulletRef); temp.SetActive(false); go_bulletListS1Gun2.Add(temp); go_bulletListS1Gun2[i].transform.parent = bulletContainerS1Gun2.transform; go_bulletListS1Gun2[i].transform.position = bulletContainerS1Gun2.transform.position; go_bulletListS1Gun2[i].name = "bulletSC1"; } //Bullets list for Scout2 Gun1 go_bulletListS2Gun1 = new List <GameObject>(); bulletContainerS2Gun1 = GameObject.Find("scout2Ammo/gun1"); for (int i = 0; i < 50; i++) { GameObject temp = Instantiate(bulletRef); temp.SetActive(false); go_bulletListS2Gun1.Add(temp); go_bulletListS2Gun1[i].transform.parent = bulletContainerS2Gun1.transform; go_bulletListS2Gun1[i].transform.position = bulletContainerS2Gun1.transform.position; go_bulletListS2Gun1[i].name = "bulletSC2"; } //Bullets list for Scout2 Gun2 go_bulletListS2Gun2 = new List <GameObject>(); bulletContainerS2Gun2 = GameObject.Find("scout2Ammo/gun2"); for (int i = 0; i < 50; i++) { GameObject temp = Instantiate(bulletRef); temp.SetActive(false); go_bulletListS2Gun2.Add(temp); go_bulletListS2Gun2[i].transform.parent = bulletContainerS2Gun2.transform; go_bulletListS2Gun2[i].transform.position = bulletContainerS2Gun2.transform.position; go_bulletListS2Gun2[i].name = "bulletSC2"; } //Bullets list for Scout3Gun1 go_bulletListS3Gun1 = new List <GameObject>(); bulletContainerS3Gun1 = GameObject.Find("scout3Ammo/gun1"); for (int i = 0; i < 50; i++) { GameObject temp = Instantiate(bulletRef); temp.SetActive(false); go_bulletListS3Gun1.Add(temp); go_bulletListS3Gun1[i].transform.parent = bulletContainerS3Gun1.transform; go_bulletListS3Gun1[i].transform.position = bulletContainerS3Gun1.transform.position; go_bulletListS3Gun1[i].name = "bulletSC3"; } //Bullets list for Scout3 Gun2 go_bulletListS3Gun2 = new List <GameObject>(); bulletContainerS3Gun2 = GameObject.Find("scout3Ammo/gun2"); for (int i = 0; i < 50; i++) { GameObject temp = Instantiate(bulletRef); temp.SetActive(false); go_bulletListS3Gun2.Add(temp); go_bulletListS3Gun2[i].transform.parent = bulletContainerS3Gun2.transform; go_bulletListS3Gun2[i].transform.position = bulletContainerS3Gun2.transform.position; go_bulletListS3Gun2[i].name = "bulletSC3"; } //Bullets list for Scout1 Gun1 go_bulletListS4Gun1 = new List <GameObject>(); bulletContainerS4Gun1 = GameObject.Find("scout4Ammo/gun1"); for (int i = 0; i < 50; i++) { GameObject temp = Instantiate(bulletRef); temp.SetActive(false); go_bulletListS4Gun1.Add(temp); go_bulletListS4Gun1[i].transform.parent = bulletContainerS4Gun1.transform; go_bulletListS4Gun1[i].transform.position = bulletContainerS4Gun1.transform.position; go_bulletListS4Gun1[i].name = "bulletSC4"; } //Bullets list for Scout1 Gun2 go_bulletListS4Gun2 = new List <GameObject>(); bulletContainerS4Gun2 = GameObject.Find("scout4Ammo/gun2"); for (int i = 0; i < 50; i++) { GameObject temp = Instantiate(bulletRef); temp.SetActive(false); go_bulletListS4Gun2.Add(temp); go_bulletListS4Gun2[i].transform.parent = bulletContainerS4Gun2.transform; go_bulletListS4Gun2[i].transform.position = bulletContainerS4Gun2.transform.position; go_bulletListS4Gun2[i].name = "bulletSC4"; } // ----- RANGERS ----- // //Missle list Ranger 1 GUN1 go_missleListR1Gun1 = new List <GameObject>(); missleContainerR1Gun1 = GameObject.Find("ranger1Ammo/gun1"); for (int i = 0; i < 6; i++) { GameObject temp = Instantiate(missleRef); temp.SetActive(false); go_missleListR1Gun1.Add(temp); go_missleListR1Gun1[i].transform.parent = missleContainerR1Gun1.transform; go_missleListR1Gun1[i].transform.position = missleContainerR1Gun1.transform.position; go_missleListR1Gun1[i].name = "missleR1"; } //Missle list Ranger 1 GUN2 go_missleListR1Gun2 = new List <GameObject>(); missleContainerR1Gun2 = GameObject.Find("ranger1Ammo/gun2"); for (int i = 0; i < 6; i++) { GameObject temp = Instantiate(missleRef); temp.SetActive(false); go_missleListR1Gun2.Add(temp); go_missleListR1Gun2[i].transform.parent = missleContainerR1Gun2.transform; go_missleListR1Gun2[i].transform.position = missleContainerR1Gun2.transform.position; go_missleListR1Gun2[i].name = "missleR1"; } //Missle list Ranger 2 GUN1 go_missleListR2Gun1 = new List <GameObject>(); missleContainerR2Gun1 = GameObject.Find("ranger2Ammo/gun1"); for (int i = 0; i < 6; i++) { GameObject temp = Instantiate(missleRef); temp.SetActive(false); go_missleListR2Gun1.Add(temp); go_missleListR2Gun1[i].transform.parent = missleContainerR2Gun1.transform; go_missleListR2Gun1[i].transform.position = missleContainerR2Gun1.transform.position; go_missleListR2Gun1[i].name = "missleR2"; } //Missle list Ranger 2 GUN2 go_missleListR2Gun2 = new List <GameObject>(); missleContainerR2Gun2 = GameObject.Find("ranger2Ammo/gun2"); for (int i = 0; i < 6; i++) { GameObject temp = Instantiate(missleRef); temp.SetActive(false); go_missleListR2Gun2.Add(temp); go_missleListR2Gun2[i].transform.parent = missleContainerR2Gun2.transform; go_missleListR2Gun2[i].transform.position = missleContainerR2Gun2.transform.position; go_missleListR2Gun2[i].name = "missleR2"; } //Missle list Ranger 3 GUN1 go_missleListR3Gun1 = new List <GameObject>(); missleContainerR3Gun1 = GameObject.Find("ranger3Ammo/gun1"); for (int i = 0; i < 6; i++) { GameObject temp = Instantiate(missleRef); temp.SetActive(false); go_missleListR3Gun1.Add(temp); go_missleListR3Gun1[i].transform.parent = missleContainerR3Gun1.transform; go_missleListR3Gun1[i].transform.position = missleContainerR3Gun1.transform.position; go_missleListR3Gun1[i].name = "missleR3"; } go_missleListR3Gun2 = new List <GameObject>(); missleContainerR3Gun2 = GameObject.Find("ranger3Ammo/gun2"); for (int i = 0; i < 6; i++) { GameObject temp = Instantiate(missleRef); temp.SetActive(false); go_missleListR3Gun2.Add(temp); go_missleListR3Gun2[i].transform.parent = missleContainerR3Gun2.transform; go_missleListR3Gun2[i].transform.position = missleContainerR3Gun2.transform.position; go_missleListR3Gun2[i].name = "missleR3"; } // ----- CORSAIRS ----- // //MissleSeeker list for Corsair1 GUN1 go_missleSeekerListC1Gun1 = new List <GameObject>(); missleSeeekerContainerC1Gun1 = GameObject.Find("corsair1Ammo/gun1"); for (int i = 0; i < 6; i++) { GameObject temp = Instantiate(missleSeekerRef); temp.SetActive(false); go_missleSeekerListC1Gun1.Add(temp); go_missleSeekerListC1Gun1[i].transform.parent = missleSeeekerContainerC1Gun1.transform; go_missleSeekerListC1Gun1[i].name = "missleSeekerC1"; } //MissleSeeker list for Corsair1 GUN2 go_missleSeekerListC1Gun2 = new List <GameObject>(); missleSeeekerContainerC1Gun2 = GameObject.Find("corsair1Ammo/gun2"); for (int i = 0; i < 6; i++) { GameObject temp = Instantiate(missleSeekerRef); temp.SetActive(false); go_missleSeekerListC1Gun2.Add(temp); go_missleSeekerListC1Gun2[i].transform.parent = missleSeeekerContainerC1Gun2.transform; go_missleSeekerListC1Gun2[i].name = "missleSeekerC1"; } //MissleSeeker list for Corsair2 GUN1 go_missleSeekerListC2Gun1 = new List <GameObject>(); missleSeeekerContainerC2Gun1 = GameObject.Find("corsair2Ammo/gun1"); for (int i = 0; i < 6; i++) { GameObject temp = Instantiate(missleSeekerRef); temp.SetActive(false); go_missleSeekerListC2Gun1.Add(temp); go_missleSeekerListC2Gun1[i].transform.parent = missleSeeekerContainerC2Gun1.transform; go_missleSeekerListC2Gun1[i].name = "missleSeekerC2"; } //MissleSeeker list for Corsair2 GUN2 go_missleSeekerListC2Gun2 = new List <GameObject>(); missleSeeekerContainerC2Gun2 = GameObject.Find("corsair2Ammo/gun2"); for (int i = 0; i < 6; i++) { GameObject temp = Instantiate(missleSeekerRef); temp.SetActive(false); go_missleSeekerListC2Gun2.Add(temp); go_missleSeekerListC2Gun2[i].transform.parent = missleSeeekerContainerC2Gun2.transform; go_missleSeekerListC2Gun2[i].name = "missleSeekerC2"; } // ----- UFO ----- // //For UFO1 go_weaponListUFO1 = new List <GameObject>(); UFO1Gun = GameObject.Find("ufo1Ammo/gun"); for (int i = 0; i < 10; i++) { GameObject temp = Instantiate(laserRef); temp.SetActive(false); go_weaponListUFO1.Add(temp); go_weaponListUFO1[i].transform.parent = UFO1Gun.transform; go_weaponListUFO1[i].transform.position = UFO1Gun.transform.position; go_weaponListUFO1[i].transform.rotation = UFO1Gun.transform.rotation; go_weaponListUFO1[i].name = "laserUFO1"; } //Load Weapon For UFO2 go_weaponListUFO2 = new List <GameObject>(); UFO2Gun = GameObject.Find("ufo2Ammo/gun"); for (int i = 0; i < 10; i++) { GameObject temp = Instantiate(laserRef); temp.SetActive(false); go_weaponListUFO2.Add(temp); go_weaponListUFO2[i].transform.parent = UFO2Gun.transform; go_weaponListUFO2[i].transform.position = UFO2Gun.transform.position; go_weaponListUFO2[i].transform.rotation = UFO2Gun.transform.rotation; go_weaponListUFO2[i].name = "laserUFO2"; } //Load Weapon For UFO3 go_weaponListUFO3 = new List <GameObject>(); UFO3Gun = GameObject.Find("ufo3Ammo/gun"); for (int i = 0; i < 10; i++) { GameObject temp = Instantiate(laserRef); temp.SetActive(false); go_weaponListUFO3.Add(temp); go_weaponListUFO3[i].transform.parent = UFO3Gun.transform; go_weaponListUFO3[i].transform.position = UFO3Gun.transform.position; go_weaponListUFO3[i].transform.rotation = UFO3Gun.transform.rotation; go_weaponListUFO3[i].name = "laserUFO3"; } }
public void PageActivatedHandler() { // UAP_AccessibilityManager.PauseAccessibility(true); //Debug.Break(); scroll.content.GetComponent <RectTransform>().pivot = new Vector2(0, 1); if (pageActivatedBefore) { return; } pageActivatedBefore = true; InitJsonList(); ObjPoolManager.RefreshPool(); // if (!pageActivatedBefore) // { //Make the pages first MakeLinkedPages(); // } //Make the buttons //They will be assigned to their buttons with 'Init' int traversalOrder = 0; ShowName = name.Split('-')[0]; if (ShowName == "CompanyDancers_Page") { if (OrderedByName == null) { Debug.LogWarning("Warning: There was no list to iterate through on page activated"); return; } foreach (Biography b in OrderedByName) { Name_Suffix = b.Name.Replace(" ", ""); GameObject go = null; ObjPoolManager.RetrieveFromPool(ObjPoolManager.Pool.Button, ref go); if (go != null) { go.name = (Name_Suffix + "_Button"); UI_Builder.UIB_Button UIB_btn = go.GetComponent <UI_Builder.UIB_Button>(); go.transform.SetParent(scroll.content.transform); //update parent for accessibility var sab = go.GetComponent <Special_AccessibleButton>(); sab.m_ManualPositionParent = go.GetComponentInParent <AccessibleUIGroupRoot>().gameObject; sab.m_ManualPositionOrder = traversalOrder; traversalOrder++; UIB_btn.SetButtonText(UIB_Utilities.SplitCamelCase(b.Name)); UIB_btn.Button_Opens = UI_Builder.UIB_Button.UIB_Button_Activates.Page; //custom backgrounds UIB_btn.Special_Background = Resources.Load("DancerPhotos/" + b.Name.Replace(" ", "_")) as Sprite; go.GetComponent <Button>().enabled = true; go.GetComponent <UAP_BaseElement>().enabled = true; UIB_btn.Init(); } } } else { foreach (string s in listOfDancers) { Name_Suffix = s.Replace("_", ""); GameObject go = null; ObjPoolManager.RetrieveFromPool(ObjPoolManager.Pool.Button, ref go); if (go != null) { go.name = (Name_Suffix + "_Button"); UI_Builder.UIB_Button UIB_btn = go.GetComponent <UI_Builder.UIB_Button>(); go.transform.SetParent(scroll.content.transform); //update parent for accessibility var sab = go.GetComponent <Special_AccessibleButton>(); sab.m_ManualPositionParent = go.GetComponentInParent <AccessibleUIGroupRoot>().gameObject; sab.m_ManualPositionOrder = traversalOrder; traversalOrder++; UIB_btn.SetButtonText(UIB_Utilities.SplitCamelCase(s.Replace("_", " "))); UIB_btn.Button_Opens = UI_Builder.UIB_Button.UIB_Button_Activates.Page; foreach (Image image in transform.GetComponentsInParent <Image>()) { } //custom backgrounds UIB_btn.Special_Background = Resources.Load("DancerPhotos/" + s.Replace("_", "_")) as Sprite; go.GetComponent <Button>().enabled = true; go.GetComponent <UAP_BaseElement>().enabled = true; //For some reason you have to do this //So that the names appear in the right order for accessibility gameObject.SetActive(false); gameObject.SetActive(true); UIB_btn.Init(); } } } scroll.GetComponent <UIB_ScrollingMenu>().playedOnce = false; scroll.GetComponent <UIB_ScrollingMenu>().Playing = false; scroll.GetComponent <UIB_ScrollingMenu>().Setup(); //create the top and bottom buffer for the scrollrect so that center selection can be highlighted var tmp = Resources.Load("UI_Buffer") as GameObject; var topBuffer = Instantiate(tmp, scroll.content.transform) as GameObject; var botBuffer = Instantiate(tmp, scroll.content.transform) as GameObject; topBuffer.GetComponent <RectTransform>().sizeDelta = new Vector2(scroll.viewport.rect.width, scroll.viewport.rect.height / 2); botBuffer.GetComponent <RectTransform>().sizeDelta = new Vector2(0, scroll.viewport.rect.height / 2); topBuffer.transform.SetAsFirstSibling(); botBuffer.transform.SetAsLastSibling(); pageActivatedBefore = true; GetComponentInParent <UIB_Page>().StartCoroutine(GetComponentInParent <UIB_Page>().ResetUAP(true)); // UAP_AccessibilityManager.PauseAccessibility(false); UAP_AccessibilityManager.Say(" "); StartCoroutine("DisableCover"); }