Пример #1
0
        private void UpdateIconStates()
        {
            var bpArr = Game.PlayerStats.GetBlueprintArray;

            int catIx = 0, catCount = bpArr.Count;

            while (catIx < catCount)
            {
                var catArr    = bpArr[catIx];
                var iconArr   = this.m_masterIconArray[catIx];
                var catString = EquipmentCategoryType.ToString(catIx);

                int itemIx = 0, itemCount = catArr.Length;
                while (itemIx < itemCount)
                {
                    var item = catArr[itemIx];
                    var icon = iconArr[itemIx];

                    if (item != 0)
                    {
                        icon.ChangeSprite("BlacksmithUI_" + catString + (itemIx % 5 + 1) + "Icon_Character");
                        for (int k = 1; k < icon.NumChildren; k++)
                        {
                            icon.GetChildAt(k).Opacity = 0.2f;
                        }
                    }
                    else
                    {
                        icon.ChangeSprite("BlacksmithUI_QuestionMarkIcon_Character");
                    }

                    if (item > 2)
                    {
                        for (int l = 1; l < icon.NumChildren; l++)
                        {
                            icon.GetChildAt(l).Opacity = 1f;
                        }

                        int num1 = catIx == 0 ? 2 : 1;

                        EquipmentBase equipmentData = Game.EquipmentSystem.GetEquipmentData(catIx, itemIx);
                        icon.GetChildAt(num1).TextureColor = equipmentData.FirstColour;

                        if (catIx != 4)
                        {
                            icon.GetChildAt(num1 + 1).TextureColor = equipmentData.SecondColour;
                        }
                    }

                    itemIx++;
                }
                catIx++;
            }
        }
Пример #2
0
        private void EquipmentSelectionInput()
        {
            var categoryIndex = m_currentCategoryIndex - 6;
            int oldIndex      = m_currentEquipmentIndex;

            if (InputManager.IsNewlyPressed(InputFlags.PlayerUp1 | InputFlags.PlayerUp2))
            {
                oldIndex = (oldIndex + 10) % 15;
            }
            else if (InputManager.IsNewlyPressed(InputFlags.PlayerDown1 | InputFlags.PlayerDown2))
            {
                oldIndex = (oldIndex + 5) % 15;
            }

            if (InputManager.IsNewlyPressed(InputFlags.PlayerLeft1 | InputFlags.PlayerLeft2))
            {
                oldIndex += oldIndex % 5 == 0 ? 4 : -1;
            }

            if (InputManager.IsNewlyPressed(InputFlags.PlayerRight1 | InputFlags.PlayerRight2))
            {
                oldIndex += oldIndex % 5 == 4 ? -4 : 1;
            }

            var bpArr = Game.PlayerStats.GetBlueprintArray[categoryIndex];

            if (oldIndex != m_currentEquipmentIndex)
            {
                m_currentEquipmentIndex = oldIndex;

                if (bpArr[oldIndex] == 1)
                {
                    bpArr[oldIndex] = 2;
                }

                UpdateNewIcons();
                UpdateIconSelectionText();
                m_selectionIcon.Position = m_activeIconArray[oldIndex].AbsPosition;
                SoundManager.PlaySound("ShopBSMenuMove");
            }

            if (InputManager.IsNewlyPressed(InputFlags.MenuCancel1 | InputFlags.MenuCancel2))
            {
                SoundManager.PlaySound("ShopMenuCancel");
                m_inCategoryMenu         = true;
                m_selectionIcon.Position = m_blacksmithUI.GetChildAt(m_currentCategoryIndex).AbsPosition;
                UpdateIconSelectionText();
            }

            if (InputManager.IsNewlyPressed(InputFlags.MenuConfirm1 | InputFlags.MenuConfirm2))
            {
                var player          = this.Player;
                int item            = bpArr[oldIndex];
                var equipArray      = Game.PlayerStats.GetEquippedArray;
                var currentEquipped = equipArray[categoryIndex];

                if (item < 3 && item > 0)
                {
                    EquipmentBase equipmentData = Game.EquipmentSystem.GetEquipmentData(categoryIndex, oldIndex);
                    if (Game.PlayerStats.Gold < equipmentData.Cost)
                    {
                        SoundManager.PlaySound("ShopMenuUnlockFail");
                    }
                    else
                    {
                        SoundManager.PlaySound("ShopMenuUnlock");
                        Game.PlayerStats.Gold -= equipmentData.Cost;
                        bpArr[oldIndex]        = 3;
                        ObjContainer firstColour = this.m_masterIconArray[categoryIndex][oldIndex];

                        firstColour.ChangeSprite("BlacksmithUI_" + EquipmentCategoryType.ToString(categoryIndex) + (oldIndex % 5 + 1) + "Icon_Character");

                        for (int i = 1; i < firstColour.NumChildren; i++)
                        {
                            firstColour.GetChildAt(i).Opacity = 1f;
                        }

                        int num1 = categoryIndex == 0 ? 2 : 1;

                        firstColour.GetChildAt(num1).TextureColor = equipmentData.FirstColour;
                        if (categoryIndex != 4)
                        {
                            firstColour.GetChildAt(num1 + 1).TextureColor = equipmentData.SecondColour;
                        }

                        item = 3;
                        this.UpdateIconSelectionText();
                    }
                }
                if (currentEquipped != oldIndex && item == 3)
                {
                    EquipmentBase equipmentDatum = Game.EquipmentSystem.GetEquipmentData(categoryIndex, oldIndex);
                    //int getEquippedArray1 = Game.PlayerStats.GetEquippedArray[categoryIndex];
                    int weight = 0;
                    if (currentEquipped != -1)
                    {
                        weight = Game.EquipmentSystem.GetEquipmentData(categoryIndex, currentEquipped).Weight;
                    }

                    if (equipmentDatum.Weight + player.CurrentWeight - weight > player.MaxWeight)
                    {
                        Console.WriteLine(string.Concat("cannot equip. too heavy. Weight:", equipmentDatum.Weight + player.CurrentWeight - weight));
                        return;
                    }
                    SoundManager.PlaySound("ShopBSEquip");
                    equipArray[categoryIndex] = (sbyte)oldIndex;
                    this.UpdateIconSelectionText();
                    Vector3 partIndices = PlayerPart.GetPartIndices(categoryIndex);

                    if (partIndices.X != -1f)
                    {
                        player.GetChildAt((int)partIndices.X).TextureColor = equipmentDatum.FirstColour;
                    }

                    if (partIndices.Y != -1f)
                    {
                        player.GetChildAt((int)partIndices.Y).TextureColor = equipmentDatum.SecondColour;
                    }

                    if (partIndices.Z != -1f)
                    {
                        player.GetChildAt((int)partIndices.Z).TextureColor = equipmentDatum.SecondColour;
                    }

                    if (categoryIndex == 2 && partIndices.X != -1f)
                    {
                        player.GetChildAt(5).TextureColor = equipmentDatum.FirstColour;
                    }

                    this.UpdateNewIcons();
                    return;
                }
                if (currentEquipped == oldIndex)
                {
                    equipArray[categoryIndex] = -1;
                    player.UpdateEquipmentColours();
                    this.UpdateIconSelectionText();
                    this.UpdateNewIcons();
                }
            }
        }
Пример #3
0
        protected virtual void Initialize()
        {
            string name;
            byte   id;

            //foreach (var f in Type.GetType("RogueCastle.SpellType").GetFields())
            //{
            //    name = f.Name;
            //    if (name.StartsWith("Total"))
            //        continue;

            //    id = (byte)f.GetRawConstantValue();
            //    var spell = RogueAPI.Spells.SpellDefinition.Register(new RogueAPI.Spells.SpellDefinition(id)
            //    {
            //        Name = name,
            //        Projectile = SpellEV.GetProjData(id, null),
            //        DamageMultiplier = SpellEV.GetDamageMultiplier(id),
            //        Rarity = SpellEV.GetRarity(id),
            //        ManaCost = SpellEV.GetManaCost(id),
            //        MiscValue1 = SpellEV.GetXValue(id),
            //        MiscValue2 = SpellEV.GetYValue(id),
            //        DisplayName = SpellType.ToString(id),
            //        Icon = SpellType.Icon(id),
            //        Description = SpellType.Description(id)
            //    });

            //    switch (id)
            //    {
            //        case 1:
            //            spell.SoundList = new[] { "Cast_Dagger" };
            //            break;

            //        case 2:
            //            spell.SoundList = new[] { "Cast_Axe" };
            //            break;

            //        case 5:
            //            spell.SoundList = new[] { "Cast_Crowstorm" };
            //            break;

            //        case 9:
            //            spell.SoundList = new[] { "Cast_Chakram" };
            //            break;

            //        case 10:
            //            spell.SoundList = new[] { "Spell_GiantSword" };
            //            break;

            //        case 13:
            //        case 15:
            //            spell.SoundList = new[] { "Enemy_WallTurret_Fire_01", "Enemy_WallTurret_Fire_02", "Enemy_WallTurret_Fire_03", "Enemy_WallTurret_Fire_04" };
            //            break;
            //    }
            //}

            //foreach (var f in Type.GetType("RogueCastle.ClassType").GetFields())
            //{
            //    name = f.Name;
            //    if (name.StartsWith("Total"))
            //        continue;

            //    id = (byte)f.GetRawConstantValue();
            //    var cls = RogueAPI.Classes.ClassDefinition.Register(new RogueAPI.Classes.ClassDefinition(id)
            //    {
            //        Name = name,
            //        Description = ClassType.Description(id),
            //        ProfileCardDescription = ClassType.ProfileCardDescription(id),
            //        DisplayName = ClassType.ToString(id, false),
            //        FemaleDisplayName = ClassType.ToString(id, true),
            //        DamageTakenMultiplier = PlayerObj.get_ClassDamageTakenMultiplier(id),
            //        HealthMultiplier = PlayerObj.get_ClassTotalHPMultiplier(id),
            //        ManaMultiplier = PlayerObj.get_ClassTotalMPMultiplier(id),
            //        MagicDamageMultiplier = PlayerObj.get_ClassMagicDamageGivenMultiplier(id),
            //        MoveSpeedMultiplier = PlayerObj.get_ClassMoveSpeedMultiplier(id),
            //        PhysicalDamageMultiplier = PlayerObj.get_ClassDamageGivenMultiplier(id)
            //    });

            //    foreach (var spellId in ClassType.GetSpellList(id))
            //        cls.AssignedSpells.Add(RogueAPI.Spells.SpellDefinition.GetById(spellId));
            //}

            var equipArray = EquipmentSystem.EquipmentDataArray;
            int catIx = 0, catCount = equipArray.Count;

            while (catIx < catCount)
            {
                var catList    = equipArray[catIx];
                var catString  = EquipmentCategoryType.ToString(catIx);
                var catString2 = EquipmentCategoryType.ToString2(catIx);

                int itemIx = 0, itemCount = catList.Length;
                while (itemIx < itemCount)
                {
                    var item = catList[itemIx];
                    name = EquipmentBaseType.ToString(itemIx);

                    item.CategoryId       = catIx;
                    item.Index            = itemIx;
                    item.DisplayName      = name + " " + catString2;
                    item.ShortDisplayName = name + " " + catString;

                    itemIx++;
                }
                catIx++;
            }

            //foreach (var f in Type.GetType("RogueCastle.TraitType").GetFields())
            //{
            //    name = f.Name;
            //    if (name.StartsWith("Total"))
            //        continue;

            //    id = (byte)f.GetRawConstantValue();
            //    var trait = RogueAPI.Traits.TraitDefinition.Register(new RogueAPI.Traits.TraitDefinition(id)
            //    {
            //        Name = name,
            //        DisplayName = TraitType.ToString(id),
            //        Description = TraitType.Description(id, false),
            //        ProfileCardDescription = TraitType.ProfileCardDescription(id),
            //        Rarity = TraitType.Rarity(id)
            //    });

            //    switch (id)
            //    {
            //        case 2:
            //            trait.ProfileCardDescription = trait.Description;
            //            trait.FemaleProfileCardDescription = trait.FemaleDescription;
            //            break;

            //        case 4:
            //            trait.TraitConflicts.Add(RogueAPI.Traits.TraitDefinition.GetById(3));
            //            break;

            //        case 7:
            //            trait.TraitConflicts.Add(RogueAPI.Traits.TraitDefinition.GetById(6));
            //            break;

            //        case 10:
            //            trait.TraitConflicts.Add(RogueAPI.Traits.TraitDefinition.GetById(9));
            //            break;

            //        case 12:
            //            trait.ClassConflicts.Add(RogueAPI.Classes.ClassDefinition.GetById(7));
            //            trait.ClassConflicts.Add(RogueAPI.Classes.ClassDefinition.GetById(15));
            //            break;

            //        case 17:
            //            trait.TraitConflicts.Add(RogueAPI.Traits.TraitDefinition.GetById(16));
            //            break;

            //        case 29:
            //            trait.TraitConflicts.Add(RogueAPI.Traits.TraitDefinition.GetById(1));
            //            break;

            //        case 31:
            //            trait.ClassConflicts.Add(RogueAPI.Classes.ClassDefinition.GetById(1));
            //            trait.ClassConflicts.Add(RogueAPI.Classes.ClassDefinition.GetById(9));
            //            trait.ClassConflicts.Add(RogueAPI.Classes.ClassDefinition.GetById(16));
            //            trait.SpellConflicts.Add(RogueAPI.Spells.SpellDefinition.GetById(4));
            //            trait.SpellConflicts.Add(RogueAPI.Spells.SpellDefinition.GetById(6));
            //            trait.SpellConflicts.Add(RogueAPI.Spells.SpellDefinition.GetById(11));
            //            break;
            //    }
            //}

            RogueAPI.Content.SpriteUtil.GraphicsDeviceManager = GraphicsDeviceManager;


            RogueAPI.Core.CreateEnemy = CreateEnemyById;
            RogueAPI.Core.AttachEnemyToCurrentRoom = AttachEnemyToCurrentRoom;
            //RogueAPI.Core.AttachEffect = AttachEffect;
            RogueAPI.Core.GetCurrentRoomTerrainObjects                   = GetCurrentTerrainObjects;
            RogueAPI.Effects.EffectDefinition.AllocateSprite             = AllocateSprite;
            RogueAPI.Projectiles.ProjectileDefinition.AllocateProjectile = AllocateProjectile;
            RogueAPI.Core.AttachPhysicsObject  = AttachPhysicsObject;
            RogueAPI.Core.ActiveEnemyCount     = ActiveEnemyCount;
            RogueAPI.Core.GetEnemyList         = GetEnemyList;
            RogueAPI.Core.GetTempEnemyList     = GetTempEnemyList;
            RogueAPI.Core.GetActiveProjectiles = GetProjectiles;
            RogueAPI.Core.DisplayNumberString  = DisplayNumberString;
            RogueAPI.Core.Initialize();

            Initialize();
        }