コード例 #1
0
        // Load Posse Delts into the scroll view
        public void ShowDeltPosse()
        {
            hideMoveOverviews();

            HouseScrollView.SetActive(false);
            PosseScrollView.SetActive(true);

            ShowHouseButtonImage.color = Color.magenta;
            ShowPosseButtonImage.color = Color.yellow;

            if (!posseDeltsLoaded)
            {
                posseDeltsLoaded = true;
                int i = 0;

                // Destroy previous list
                foreach (Transform child in PosseContentTransform)
                {
                    Destroy(child.gameObject);
                }

                // Populate list
                foreach (DeltemonClass posseDelt in GameMan.deltPosse)
                {
                    GameObject li    = Instantiate(DeltListItem, PosseContentTransform);
                    Text[]     texts = li.GetComponentsInChildren <Text>();
                    texts[0].text = posseDelt.nickname;
                    texts[1].text = "Lv. " + posseDelt.level;
                    li.transform.GetChild(0).GetComponent <Image>().color = posseDelt.deltdex.major1.background;

                    if (posseDelt.deltdex.major2.majorName == "NoMajor")
                    {
                        li.transform.GetChild(3).GetComponent <Image>().sprite = posseDelt.deltdex.major1.majorImage;
                        li.GetComponent <Image>().color = posseDelt.deltdex.major1.background;
                    }
                    else
                    {
                        li.transform.GetChild(4).GetComponent <Image>().sprite = posseDelt.deltdex.major1.majorImage;
                        li.transform.GetChild(5).GetComponent <Image>().sprite = posseDelt.deltdex.major2.majorImage;
                        li.GetComponent <Image>().color = posseDelt.deltdex.major2.background;
                    }

                    Button b = li.transform.GetChild(6).gameObject.GetComponent <Button>();
                    AddListener(b, i, false);
                    li.transform.localScale = Vector3.one;
                    i++;
                }
            }
        }
コード例 #2
0
        // Load House Delts into the scroll view
        public void ShowHouseDelts()
        {
            hideMoveOverviews();

            HouseScrollView.SetActive(true);
            PosseScrollView.SetActive(false);

            ShowHouseButtonImage.color = Color.yellow;
            ShowPosseButtonImage.color = Color.magenta;

            if (!houseDeltsLoaded)
            {
                houseDeltsLoaded = true;
                int i = 0;

                // Destroy previous list
                foreach (Transform child in HouseContentTransform)
                {
                    Destroy(child.gameObject);
                }

                queryResults.Clear();

                // Load house Delts into UI
                foreach (DeltemonData houseDelt in GameMan.houseDelts)
                {
                    DeltDexClass tmpDex = ((GameObject)Resources.Load("Deltemon/DeltDex/" + houseDelt.deltdexName + "DD")).GetComponent <DeltDexClass>();
                    // Do not show Delts that do not match search query
                    if (isSearch)
                    {
                        // Check names, pin, level, item, and majors
                        if (!(houseDelt.nickname.Contains(nameQuery) || houseDelt.deltdexName.Contains(nameQuery) || tmpDex.nickname.Contains(nameQuery)))
                        {
                            continue;
                        }
                        else if ((tmpDex.pinNumber < pinQuery) || (houseDelt.level < levelQuery))
                        {
                            continue;
                        }
                        else if (itemQuery && string.IsNullOrEmpty(houseDelt.itemName))
                        {
                            continue;
                        }
                        else if (!majorQuery.Contains(tmpDex.major1) && !majorQuery.Contains(tmpDex.major2))
                        {
                            continue;
                        }
                        // Add if query fits
                        queryResults.Add(houseDelt);
                    }
                    else
                    {
                        queryResults = new List <DeltemonData>(GameMan.houseDelts);
                    }

                    GameObject li    = Instantiate(DeltListItem, HouseContentTransform);
                    Text[]     texts = li.GetComponentsInChildren <Text>();
                    texts[0].text = houseDelt.nickname;
                    texts[1].text = "Lv. " + houseDelt.level;

                    li.transform.GetChild(0).GetComponent <Image>().color = tmpDex.major1.background;
                    if (tmpDex.major2.majorName == "NoMajor")
                    {
                        li.transform.GetChild(3).GetComponent <Image>().sprite = tmpDex.major1.majorImage;
                        li.GetComponent <Image>().color = tmpDex.major1.background;
                    }
                    else
                    {
                        li.transform.GetChild(4).GetComponent <Image>().sprite = tmpDex.major1.majorImage;
                        li.transform.GetChild(5).GetComponent <Image>().sprite = tmpDex.major2.majorImage;
                        li.GetComponent <Image>().color = tmpDex.major2.background;
                    }

                    Button b = li.transform.GetChild(6).gameObject.GetComponent <Button>();
                    AddListener(b, i, true);
                    li.transform.localScale = Vector3.one;
                    i++;
                }
            }

            // If BankUI not open, slide it in.
            if (!BankUI.activeInHierarchy)
            {
                BankUI.SetActive(true);
                BankUI.GetComponent <Animator>().SetBool("SlideIn", true);

                // If not a search query, slide out Option Menu
                if (!isSearch)
                {
                    OptionMenuUI.GetComponent <Animator>().SetBool("SlideIn", false);
                }
            }
        }