Example #1
0
    void Start()
    {
        quiver    = new Skewer[numberOfSkewers];
        quiver[0] = new Skewer();
        quiver[1] = new Skewer();
        quiver[2] = new Skewer();
        CanSwap   = true;
        sfxPlayer = GetComponent <PlaySFX>();

        //initialize dictionaries
        for (int i = 0; i < quiver.Length; i++)
        {
            quiver[i].InitializeDictionary();
        }
    }
Example #2
0
        public Magnus(Unit9 owner, MultiSleeper abilitySleeper, Sleeper orbwalkSleeper, ControllableUnitMenu menu)
            : base(owner, abilitySleeper, orbwalkSleeper, menu)
        {
            this.ComboAbilities = new Dictionary <AbilityId, Func <ActiveAbility, UsableAbility> >
            {
                { AbilityId.magnataur_shockwave, x => this.shockwave = new Shockwave(x) },
                {
                    AbilityId.magnataur_skewer, x =>
                    {
                        this.skewer = new Skewer(x);
                        this.polarity?.AddSkewer(this.skewer);
                        return(this.skewer);
                    }
                },
                {
                    AbilityId.magnataur_reverse_polarity, x =>
                    {
                        this.polarity = new ReversePolarity(x);
                        if (this.skewer != null)
                        {
                            this.polarity.AddSkewer(this.skewer);
                        }

                        return(this.polarity);
                    }
                },

                { AbilityId.item_blink, x => this.blink = new BlinkDaggerMagnus(x) },
                { AbilityId.item_swift_blink, x => this.blink = new BlinkDaggerMagnus(x) },
                { AbilityId.item_arcane_blink, x => this.blink = new BlinkDaggerMagnus(x) },
                { AbilityId.item_overwhelming_blink, x => this.blink = new BlinkDaggerMagnus(x) },
                { AbilityId.item_force_staff, x => this.force = new ForceStaff(x) },
                { AbilityId.item_shivas_guard, x => this.shiva = new ShivasGuard(x) },
                { AbilityId.item_refresher, x => this.refresher = new UntargetableAbility(x) },
                { AbilityId.item_refresher_shard, x => this.refresherShard = new UntargetableAbility(x) },
            };

            this.MoveComboAbilities.Add(AbilityId.magnataur_skewer, x => this.moveSkewer = new BlinkAbility(x));
        }
Example #3
0
        // Token: 0x06000549 RID: 1353 RVA: 0x0001B2B4 File Offset: 0x000194B4
        public void BlinkSkewerCombo(TargetManager targetManager, BlinkSkewerModeMenu menu)
        {
            if (base.ComboSleeper.IsSleeping)
            {
                return;
            }
            BlinkDaggerMagnus blinkDaggerMagnus = this.blink;

            if (blinkDaggerMagnus != null && blinkDaggerMagnus.Ability.CanBeCasted(true))
            {
                Skewer skewer = this.skewer;
                if (skewer != null && skewer.Ability.CanBeCasted(true))
                {
                    Vector3 predictedPosition = targetManager.Target.GetPredictedPosition(this.skewer.Ability.CastPoint);
                    Vector3 blinkPosition     = Vector3Extensions.Extend2D(base.Owner.Position, predictedPosition, base.Owner.Distance(predictedPosition) + 100f);
                    float   num = base.Owner.Distance(blinkPosition);
                    if (this.blink.Ability.CastRange < num)
                    {
                        return;
                    }
                    Unit9 unit = (from x in targetManager.AllyHeroes
                                  where !x.Equals(this.Owner) && menu.IsAllyEnabled(x.Name) && x.Distance(blinkPosition) < this.skewer.Ability.CastRange + 800f
                                  orderby x.Distance(blinkPosition)
                                  select x).FirstOrDefault <Unit9>();
                    if (unit == null)
                    {
                        return;
                    }
                    base.OrbwalkSleeper.Sleep(this.skewer.Ability.CastPoint + 0.3f);
                    this.blink.Ability.UseAbility(blinkPosition, false, false);
                    this.skewer.Ability.UseAbility(unit.Position, false, false);
                    base.ComboSleeper.Sleep(0.3f);
                    return;
                }
            }
        }
Example #4
0
    private void OnTriggerEnter(Collider collision)
    {
        if (collision.gameObject.tag == "Skewer")
        {
            Skewer skewer = collision.gameObject.GetComponent <Skewer>();

            for (int i = 0; i < Mathf.Min(gc.recipeItemCount, skewer.skeweredObjects.Count); i++)
            {
                if (skewer.skeweredObjects[i].GetComponent <VegeType>().type == gc.currentRecipe[i].GetComponent <VegeType>().type)
                {
                    correctItems++;
                    if (correctItems >= gc.recipeItemCount)
                    {
                        Debug.Log("Recipe Made!");
                        gc.MakeRecipe();
                        gc.AddScore();
                    }
                }
            }

            Destroy(collision.gameObject);
            correctItems = 0;
        }
    }
Example #5
0
        public void UpdateButton(ref Skewer.SkewerItem item, SimInfo info, bool bUpdateThumbnail, bool bUseCurrentThumbAsPlaceholder)
        {
            try
            {
                Skewer.Instance.UpdateButton(ref item, info, bUpdateThumbnail, bUseCurrentThumbAsPlaceholder);

                if (item.mGoButton != null)
                {
                    item.mGoButton.Visible = ShouldShowGoHomeButtonForSim(item.mSimInfo.mGuid);
                }
            }
            catch (Exception e)
            {
                Common.Exception(info.mName, e);
            }
        }
Example #6
0
        public bool UpdateForMoodChange(ref Skewer.SkewerItem[] skewerItems, SimInfo simInfo, bool bUpdateThumbnails)
        {
            if (simInfo != null)
            {
                for (int i = 0x0; i < skewerItems.Length; i++)
                {
                    if (Matches(skewerItems[i].mSimInfo, simInfo))
                    {
                        UpdateButton(ref skewerItems[i], simInfo, bUpdateThumbnails, true);

                        return true;
                    }
                }
            }
            return false;
        }
Example #7
0
        protected void Populate(ref Skewer.SkewerItem[] skewerItems, int skewerStart, List<SimInfo> simInfo, int iterationIndex, float deltaSize, ref float size)
        {
            int startIndex = mStartIterations[iterationIndex];

            int count = 0;

            if (iterationIndex == 0)
            {
                if (!PortraitPanel.Settings.mUsePortraitSeventeen)
                {
                    startIndex *= 23;
                    count = 23;
                }
                else
                {
                    startIndex *= 24;
                    count = 24;
                }
            }
            else if ((iterationIndex == 3) && (!PortraitPanel.Settings.mUsePortraitSeventeen))
            {
                startIndex *= 7;
                count = 7;
            }
            else
            {
                startIndex *= 8;
                count = 8;
            }

            if (startIndex >= simInfo.Count)
            {
                startIndex = 0;

                mStartIterations[iterationIndex] = 0;
            }

            if (count > (simInfo.Count - startIndex))
            {
                count = (simInfo.Count - startIndex);
            }

            for (int j = 0; j < count; j++)
            {
                int simIndex = j + startIndex;
                //if (simIndex >= simInfo.Count) break;

                int skewerIndex = j + skewerStart;
                //if (skewerIndex >= skewerItems.Length) break;

                if (skewerIndex == 16)
                {
                    if (!PortraitPanel.Settings.mUsePortraitSeventeen)
                    {
                        skewerStart++;
                        skewerIndex++;
                    }
                }

                if (simInfo[simIndex] == null) continue;

                if (skewerItems[skewerIndex].mButton != null)
                {
                    skewerItems[skewerIndex].mButton.Tag = simInfo[simIndex];
                }

                skewerItems[skewerIndex].mSimInfo = simInfo[simIndex];
                UpdateButton(ref skewerItems[skewerIndex], simInfo[simIndex], true, false);
                Skewer.Instance.UpdateMoodWindow(skewerItems[skewerIndex].mMood, simInfo[simIndex]);

                size += deltaSize;
            }
        }
Example #8
0
        public void PopulateSkewer(Window skewer, ref Skewer.SkewerItem[] skewerItems, float baseSize, float deltaSize)
        {
            Common.StringBuilder msg = new Common.StringBuilder("PopulateSkewer");

            try
            {
                if (mCyclePortraits != null)
                {
                    mCyclePortraits.Visible = ((PortraitPanel.Settings.mShowCycleButton) || (!PortraitPanel.Settings.mShowSimMenu) || (mSimInfo.Count > 24));
                }

                if (Skewer.Instance.mPetsSkewer != null)
                {
                    Skewer.Instance.mPetsSkewer.Visible = false;
                }

                HideSkewer(ref Skewer.Instance.mHouseholdItems);
                HideSkewer(ref Skewer.Instance.mPetItems);
                HideSkewer(ref skewerItems);

                float num = baseSize + (deltaSize * 8f);

                msg += Common.NewLine + num;

                skewer.Visible = false;
                if ((mSimInfo != null) && (mSimInfo.Count > 0))
                {
                    Sorter sorter = new Sorter(0);

                    Sorter.SorterFunc sort = sorter.GetSort();
                    if (sort != null)
                    {
                        mSimInfo.Sort(new Comparison<SimInfo>(sort));
                    }

                    int maximumPortraits = 24;
                    int maximumColumn3 = 8;
                    if (!PortraitPanel.Settings.mUsePortraitSeventeen)
                    {
                        maximumPortraits--;
                        maximumColumn3--;
                    }

                    int count = mSimInfo.Count;
                    if (count > 0x0)
                    {
                        msg += Common.NewLine + count;

                        bool exceeded = false;

                        List<SimInfo> column1 = new List<SimInfo>();
                        List<SimInfo> column2 = new List<SimInfo>();
                        List<SimInfo> column3 = new List<SimInfo>();

                        if ((mSimInfo.Count > maximumPortraits) && (PortraitPanel.Settings.mRevertToSingleListOnTooMany))
                        {
                            exceeded = true;
                        }
                        else
                        {
                            foreach (SimInfo info in mSimInfo)
                            {
                                SimDescription sim = PortraitPanel.Settings.GetSim(info);
                                if (sim == null) continue;

                                List<List<SimInfo>> choices = new List<List<SimInfo>>();
                                List<int> maximums = new List<int>();

                                if (IsVisible(sim, PortraitPanel.Settings.mColumnFilter1, false, 1))
                                {
                                    msg += Common.NewLine + "IsVisible 1";

                                    choices.Add(column1);
                                    maximums.Add(8);
                                }
                                
                                if (IsVisible(sim, PortraitPanel.Settings.mColumnFilter2, false, 2))
                                {
                                    msg += Common.NewLine + "IsVisible 2";

                                    choices.Add(column2);
                                    maximums.Add(8);
                                }
                                
                                if (IsVisible(sim, PortraitPanel.Settings.mColumnFilter3, false, 3))
                                {
                                    msg += Common.NewLine + "IsVisible 3";

                                    choices.Add(column3);
                                    maximums.Add(maximumColumn3);
                                }
                                
                                if ((choices.Count == 0) && (PortraitPanel.Settings.mRevertToSingleListOnFilterFail))
                                {
                                    msg += Common.NewLine + "Exceeded 1";

                                    exceeded = true;
                                }

                                bool placed = false;
                                for (int i = 0; i < choices.Count; i++)
                                {
                                    if (choices[i].Count < maximums[i])
                                    {
                                        choices[i].Add(info);
                                        placed = true;
                                        break;
                                    }
                                }

                                if (!placed)
                                {
                                    if (PortraitPanel.Settings.mRevertToSingleListOnFilterFail)
                                    {
                                        msg += Common.NewLine + "Exceeded 2";

                                        exceeded = true;
                                    }
                                    else if (choices.Count > 0)
                                    {
                                        choices[0].Add(info);
                                    }
                                }
                            }
                        }

                        if ((column1.Count + column2.Count + column3.Count) == 0)
                        {
                            msg += Common.NewLine + "Exceeded 3";

                            exceeded = true;
                        }

                        float num4 = baseSize;
                        if (exceeded)
                        {
                            Populate(ref skewerItems, 0, mSimInfo, 0, deltaSize, ref num4);
                        }
                        else
                        {
                            Populate(ref skewerItems, 0, column1, 1, deltaSize, ref num4);
                            Populate(ref skewerItems, 8, column2, 2, deltaSize, ref num4);
                            Populate(ref skewerItems, 16, column3, 3, deltaSize, ref num4);
                        }

                        Rect area = skewer.Area;
                        area.Set(area.TopLeft.x, num - num4, area.BottomRight.x, area.BottomRight.y);
                        skewer.Area = area;
                        skewer.Visible = true;
                    }
                }
            }
            catch (Exception exception)
            {
                Common.Exception(msg, exception);
            }
            finally
            {
                //Common.DebugWriteLog(msg);
            }
        }
Example #9
0
        public static void HideSkewer(ref Skewer.SkewerItem[] skewerItems)
        {
            for (int i = 0x0; i < skewerItems.Length; i++)
            {
                skewerItems[i].mButton.Tag = null;
                skewerItems[i].mButton.CreateTooltipCallbackFunction = CreateSimTooltip;
                skewerItems[i].mSimInfo = null;
                skewerItems[i].mContainer.Visible = false;
                skewerItems[i].mbShouldShowFollowNotify = false;
                skewerItems[i].mFollowNotification.Visible = false;
                if (skewerItems[i].mGroupButton != null)
                {
                    skewerItems[i].mGroupButton.Visible = false;
                }

                if (skewerItems[i].mDateButton != null)
                {
                    skewerItems[i].mDateButton.Visible = false;
                }

                if (skewerItems[i].mGoButton != null)
                {
                    skewerItems[i].mGoButton.Visible = false;
                }
            }
        }