示例#1
0
        public void AddDeltDex(DeltDexClass newDex)
        {
            if (!deltDex.Exists(x => x.pin == newDex.pinNumber))
            {
                deltDex.Add(ConvertDexToData(newDex));

                UIManager.StartMessage((newDex.nickname + " was added to " + playerName + "'s DeltDex!"));

#if !UNITY_EDITOR && (UNITY_IOS || UNITY_ANDROID)
                // Update leaderboard
                AchievementManager.Inst.UpdateDeltDexCount(deltDex.Count);
#endif

                // Update DeltDexUI on next load
                UIManager.allDexesLoaded = false;

                // Sort Dexes by pin number, from highest->lowest (since lower pin = older members)
                deltDex.Sort(delegate(DeltDexData dataA, DeltDexData dataB)
                {
                    if (dataA.pin > dataB.pin)
                    {
                        return(-1);
                    }
                    else
                    {
                        return(1);
                    }
                });
            }
        }
示例#2
0
        public DeltDexData ConvertDexToData(DeltDexClass dex)
        {
            DeltDexData newDexData = new DeltDexData();

            newDexData.nickname   = dex.nickname;
            newDexData.actualName = dex.deltName;
            newDexData.pin        = dex.pinNumber;
            newDexData.rarity     = dex.rarity;
            return(newDexData);
        }
示例#3
0
        // Add new DeltDex Data entry to player
        DeltDexData newDeltDexData(DeltDexClass deltDex)
        {
            DeltDexData ddd = new DeltDexData();

            ddd.actualName = deltDex.deltName;
            ddd.nickname   = deltDex.nickname;
            ddd.pin        = deltDex.pinNumber;
            ddd.rarity     = deltDex.rarity;
            return(ddd);
        }
示例#4
0
        public void PresentEvolveUI(DeltemonClass evolvingDelt, DeltDexClass nextEvol)
        {
            Image prevEvolImage = EvolveUI.transform.GetChild(1).GetComponent <Image>();
            Image nextEvolImage = EvolveUI.transform.GetChild(2).GetComponent <Image>();

            // Set images for evolution animation
            prevEvolImage.sprite = evolvingDelt.deltdex.frontImage;
            nextEvolImage.sprite = nextEvol.frontImage;
            EvolveUI.SetActive(true);

            // Set battle image to new image
            PlayerDeltInfo.Image.sprite = evolvingDelt.deltdex.backImage;
        }
示例#5
0
        void EvolveDelt()
        {
            DeltemonClass evolvingDelt = State.PlayerState.DeltInBattle;
            DeltDexClass  nextEvol     = evolvingDelt.GetNextEvolution();

            // Open Evolve UI
            BattleManager.AddToBattleQueue(action: () => BattleManager.Inst.BattleUI.PresentEvolveUI(evolvingDelt, nextEvol));

            // Text for before evolution animation
            if (GameManager.Inst.pork)
            {
                BattleManager.AddToBattleQueue("WHAT IS PORKKENING?!?");
                BattleManager.AddToBattleQueue("TIME TO BECOME A HONKING BOAR!");
            }
            else
            {
                // REFACTOR_TODO: Get some random text variation in here
                // REFACTOR_TODO: Make a random text generator that takes a text ID and returns a string or string[]
                BattleManager.AddToBattleQueue("Yo...");
                BattleManager.AddToBattleQueue("What's happening?");
            }

            // Start evolution animation, wait to end
            // REFACTOR_TODO: This animation had a ending trigger as well: is that needed?
            BattleManager.AddToBattleQueue(enumerator: BattleManager.Inst.Animator.DeltAnimation("Evolve", true)); // 6.5 seconds

            // Text for after evolution animation
            if (GameManager.Inst.pork)
            {
                BattleManager.AddToBattleQueue("A NEW PORKER IS BORN!");
                BattleManager.AddToBattleQueue("A gush of pink bacon-smelling amneotic fluid from the evolution stains the ground.");
                BattleManager.AddToBattleQueue("I wish this could have happened somewhere more private.");
            }
            else
            {
                BattleManager.AddToBattleQueue(evolvingDelt.nickname + " has evolved into " + nextEvol.nickname + "!");
            }

            // If Delt's name is not custom nicknamed by the player, make it the evolution's nickname
            if (evolvingDelt.nickname == evolvingDelt.deltdex.nickname)
            {
                evolvingDelt.nickname = nextEvol.nickname;
            }

            // Set the deltdex to the evolution's deltdex
            // Note: This is how the Delt stays evolved
            evolvingDelt.deltdex = nextEvol;

            // Add dex to deltDex if not there already
            GameManager.Inst.AddDeltDex(evolvingDelt.deltdex);
        }
示例#6
0
        // Loads DeltDex information into Dex Overview UI
        public void LoadIntoDeltdexOverview(int i) // REFACTOR_TODO: Make this function not terrible and get references to all of these
        {
            DeltDexData ddd = GameManager.Inst.deltDex[i];

            curOverviewDex = (GameObject)Resources.Load("Deltemon/DeltDex/" + ddd.nickname + "DD");
            DeltDexClass dex = curOverviewDex.transform.GetComponent <DeltDexClass>();

            // Set background colors based on major
            DeltDexOverviewUI.GetComponent <Image>().color = dex.major1.background;
            if (dex.major2.majorName == "NoMajor")
            {
                DeltDexOverviewUI.GetChild(0).gameObject.SetActiveIfChanged(false);
            }
            else
            {
                DeltDexOverviewUI.GetChild(0).gameObject.GetComponent <Image>().color = dex.major2.background;
                DeltDexOverviewUI.GetChild(0).gameObject.SetActiveIfChanged(true);
            }

            if (GameManager.Inst.pork)
            {
                // Set front and back image, respectively
                DeltDexOverviewUI.GetChild(1).gameObject.GetComponent <Image>().sprite = PorkSprite;
                DeltDexOverviewUI.GetChild(2).gameObject.GetComponent <Image>().sprite = PorkManager.Inst.PorkSprite;
                // Set names and description
                DeltDexOverviewUI.GetChild(5).gameObject.GetComponent <Text>().text = "What is " + dex.nickname + "!?";
                DeltDexOverviewUI.GetChild(6).gameObject.GetComponent <Text>().text = "Ribbert " + dex.deltName + " Rinderson";;
                DeltDexOverviewUI.GetChild(7).gameObject.GetComponent <Text>().text = dex.description;
            }
            else
            {
                // Set front and back image, respectively
                DeltDexOverviewUI.GetChild(1).gameObject.GetComponent <Image>().sprite = dex.frontImage;
                DeltDexOverviewUI.GetChild(2).gameObject.GetComponent <Image>().sprite = dex.backImage;
                // Set names and description
                DeltDexOverviewUI.GetChild(5).gameObject.GetComponent <Text>().text = dex.nickname;
                DeltDexOverviewUI.GetChild(6).gameObject.GetComponent <Text>().text = dex.deltName;
                DeltDexOverviewUI.GetChild(7).gameObject.GetComponent <Text>().text = dex.description;
            }

            // Set major images
            DeltDexOverviewUI.GetChild(3).gameObject.GetComponent <Image>().sprite         = dex.major1.majorImage;
            DeltDexOverviewUI.GetChild(3).gameObject.GetComponent <Image>().preserveAspect = true;
            DeltDexOverviewUI.GetChild(4).gameObject.GetComponent <Image>().sprite         = dex.major2.majorImage;
            DeltDexOverviewUI.GetChild(4).gameObject.GetComponent <Image>().preserveAspect = true;

            // Create base values string
            short  total      = 0;
            string baseValues = "";

            for (int index = 0; index < 6; index++)
            {
                total      += dex.BVs[index];
                baseValues += System.Environment.NewLine + dex.BVs[index];
            }
            baseValues.Insert(0, total.ToString());

            // Set stats
            DeltDexOverviewUI.GetChild(8).gameObject.GetComponent <Text>().text = baseValues;

            // Set evolution buttons, onclick to load that evolution's dex to overview
            if (dex.prevEvol != null)
            {
                prevEvol.gameObject.SetActiveIfChanged(true);
                int dexIndex = GameManager.Inst.deltDex.FindIndex(dd => dd.actualName == dex.prevEvol.deltName);
                if (dexIndex != -1)
                {
                    prevEvol.transform.GetChild(0).gameObject.GetComponent <Text>().text = dex.prevEvol.nickname;
                    EvolButtonListener(prevEvol, dexIndex);
                }
                else
                {
                    if (GameManager.Inst.pork)
                    {
                        prevEvol.transform.GetChild(0).gameObject.GetComponent <Text>().text = "What is!?";
                    }
                    else
                    {
                        prevEvol.transform.GetChild(0).gameObject.GetComponent <Text>().text = "???";
                    }
                }
            }
            else
            {
                prevEvol.gameObject.SetActiveIfChanged(false);
            }
            if (dex.nextEvol != null)
            {
                nextEvol.gameObject.SetActiveIfChanged(true);
                int dexIndex = GameManager.Inst.deltDex.FindIndex(dd => dd.actualName == dex.nextEvol.deltName);
                if (dexIndex != -1)
                {
                    nextEvol.transform.GetChild(0).gameObject.GetComponent <Text>().text = dex.nextEvol.nickname;
                    EvolButtonListener(nextEvol, dexIndex);
                }
                else
                {
                    if (GameManager.Inst.pork)
                    {
                        nextEvol.transform.GetChild(0).gameObject.GetComponent <Text>().text = "What is!?";
                    }
                    else
                    {
                        nextEvol.transform.GetChild(0).gameObject.GetComponent <Text>().text = "???";
                    }
                }
            }
            else
            {
                nextEvol.gameObject.SetActiveIfChanged(false);
            }

            // Present UI when loaded
            if (!DeltDexOverviewUI.gameObject.activeInHierarchy)
            {
                DeltDexOverviewUI.gameObject.SetActiveIfChanged(true);
            }
        }
示例#7
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);
                }
            }
        }
示例#8
0
 // When user selects starter from button
 public void SelectStarter(DeltDexClass selectedStarter)
 {
     starter          = emptyDelt;
     starter.deltdex  = selectedStarter;
     starter.nickname = selectedStarter.nickname;
 }