예제 #1
0
    public void SetWeapon(PlayerWeapons weapon)
    {
        /* ColorSwap and Shader to change MegaMan's color scheme
         *
         * his spritesheets have been altered to greyscale for his outfit
         * Red 64 for the helmet, gloves, boots, etc ( SwapIndex.Primary )
         * Red 128 for his shirt, pants, etc ( SwapIndex.Secondary )
         *
         * couple ways to code this but I settled on #2
         *
         * #1 using Lists
         *
         * var colorIndex = new List<int>();
         * var playerColors = new List<Color>();
         * colorIndex.Add((int)SwapIndex.Primary);
         * colorIndex.Add((int)SwapIndex.Secondary);
         * playerColors.Add(ColorSwap.ColorFromIntRGB(64, 64, 64));
         * playerColors.Add(ColorSwap.ColorFromIntRGB(128, 128, 128));
         * colorSwap.SwapColors(colorIndex, playerColors);
         *
         * #2 using SwapColor as needed then ApplyColor
         *
         * colorSwap.SwapColor((int)SwapIndex.Primary, ColorSwap.ColorFromInt(0x0073F7));
         * colorSwap.SwapColor((int)SwapIndex.Secondary, ColorSwap.ColorFromInt(0x00FFFF));
         * colorSwap.ApplyColor();
         *
         * Also, we'll change the color of our weapon energy bar
         * and adjust the energy value as given in the playerWeaponsStruct
         *
         */

        // set new selected weapon (determines color scheme)
        playerWeapon = weapon;

        // calculate weapon energy value to adjust the bars
        int   currentEnergy     = playerWeaponStructs[(int)playerWeapon].currentEnergy;
        int   maxEnergy         = playerWeaponStructs[(int)playerWeapon].maxEnergy;
        float weaponEnergyValue = (float)currentEnergy / (float)maxEnergy;

        // apply new selected color scheme with ColorSwap and set weapon energy bar
        switch (playerWeapon)
        {
        case PlayerWeapons.Default:
            // dark blue, light blue
            colorSwap.SwapColor((int)SwapIndex.Primary, ColorSwap.ColorFromInt(0x0073F7));
            colorSwap.SwapColor((int)SwapIndex.Secondary, ColorSwap.ColorFromInt(0x00FFFF));
            // the player weapon energy doesn't apply but we'll just set the default and hide it
            UIEnergyBars.Instance.SetImage(UIEnergyBars.EnergyBars.PlayerWeapon, UIEnergyBars.EnergyBarTypes.PlayerLife);
            UIEnergyBars.Instance.SetVisibility(UIEnergyBars.EnergyBars.PlayerWeapon, false);
            break;

        case PlayerWeapons.MagnetBeam:
            // dark blue, light blue
            colorSwap.SwapColor((int)SwapIndex.Primary, ColorSwap.ColorFromInt(0x0073F7));
            colorSwap.SwapColor((int)SwapIndex.Secondary, ColorSwap.ColorFromInt(0x00FFFF));
            // magnet beam energy and set visible
            UIEnergyBars.Instance.SetImage(UIEnergyBars.EnergyBars.PlayerWeapon, UIEnergyBars.EnergyBarTypes.MagnetBeam);
            UIEnergyBars.Instance.SetValue(UIEnergyBars.EnergyBars.PlayerWeapon, weaponEnergyValue);
            UIEnergyBars.Instance.SetVisibility(UIEnergyBars.EnergyBars.PlayerWeapon, true);
            break;

        case PlayerWeapons.BombMan:
            // green, light gray
            colorSwap.SwapColor((int)SwapIndex.Primary, ColorSwap.ColorFromInt(0x009400));
            colorSwap.SwapColor((int)SwapIndex.Secondary, ColorSwap.ColorFromInt(0xFCFCFC));
            // bombman's hyper bomb weapon energy and set visible
            UIEnergyBars.Instance.SetImage(UIEnergyBars.EnergyBars.PlayerWeapon, UIEnergyBars.EnergyBarTypes.HyperBomb);
            UIEnergyBars.Instance.SetValue(UIEnergyBars.EnergyBars.PlayerWeapon, weaponEnergyValue);
            UIEnergyBars.Instance.SetVisibility(UIEnergyBars.EnergyBars.PlayerWeapon, true);
            break;

        case PlayerWeapons.CutMan:
            // dark gray, light gray
            colorSwap.SwapColor((int)SwapIndex.Primary, ColorSwap.ColorFromInt(0x747474));
            colorSwap.SwapColor((int)SwapIndex.Secondary, ColorSwap.ColorFromInt(0xFCFCFC));
            // cutman's rolling cutter weapon energy and set visible
            UIEnergyBars.Instance.SetImage(UIEnergyBars.EnergyBars.PlayerWeapon, UIEnergyBars.EnergyBarTypes.RollingCutter);
            UIEnergyBars.Instance.SetValue(UIEnergyBars.EnergyBars.PlayerWeapon, weaponEnergyValue);
            UIEnergyBars.Instance.SetVisibility(UIEnergyBars.EnergyBars.PlayerWeapon, true);
            break;

        case PlayerWeapons.ElecMan:
            // dark gray, light yellow
            colorSwap.SwapColor((int)SwapIndex.Primary, ColorSwap.ColorFromInt(0x747474));
            colorSwap.SwapColor((int)SwapIndex.Secondary, ColorSwap.ColorFromInt(0xFCE4A0));
            // elecman's thunderbeam weapon energy and set visible
            UIEnergyBars.Instance.SetImage(UIEnergyBars.EnergyBars.PlayerWeapon, UIEnergyBars.EnergyBarTypes.ThunderBeam);
            UIEnergyBars.Instance.SetValue(UIEnergyBars.EnergyBars.PlayerWeapon, weaponEnergyValue);
            UIEnergyBars.Instance.SetVisibility(UIEnergyBars.EnergyBars.PlayerWeapon, true);
            break;

        case PlayerWeapons.FireMan:
            // dark orange, yellow gold
            colorSwap.SwapColor((int)SwapIndex.Primary, ColorSwap.ColorFromInt(0xD82800));
            colorSwap.SwapColor((int)SwapIndex.Secondary, ColorSwap.ColorFromInt(0xF0BC3C));
            // fireman's firestorm weapon energy and set visible
            UIEnergyBars.Instance.SetImage(UIEnergyBars.EnergyBars.PlayerWeapon, UIEnergyBars.EnergyBarTypes.FireStorm);
            UIEnergyBars.Instance.SetValue(UIEnergyBars.EnergyBars.PlayerWeapon, weaponEnergyValue);
            UIEnergyBars.Instance.SetVisibility(UIEnergyBars.EnergyBars.PlayerWeapon, true);
            break;

        case PlayerWeapons.GutsMan:
            // orange red, light gray
            colorSwap.SwapColor((int)SwapIndex.Primary, ColorSwap.ColorFromInt(0xC84C0C));
            colorSwap.SwapColor((int)SwapIndex.Secondary, ColorSwap.ColorFromInt(0xFCFCFC));
            // gutman's super arm weapon energy and set visible
            UIEnergyBars.Instance.SetImage(UIEnergyBars.EnergyBars.PlayerWeapon, UIEnergyBars.EnergyBarTypes.SuperArm);
            UIEnergyBars.Instance.SetValue(UIEnergyBars.EnergyBars.PlayerWeapon, weaponEnergyValue);
            UIEnergyBars.Instance.SetVisibility(UIEnergyBars.EnergyBars.PlayerWeapon, true);
            break;

        case PlayerWeapons.IceMan:
            // dark blue, light gray
            colorSwap.SwapColor((int)SwapIndex.Primary, ColorSwap.ColorFromInt(0x2038EC));
            colorSwap.SwapColor((int)SwapIndex.Secondary, ColorSwap.ColorFromInt(0xFCFCFC));
            // iceman's ice slasher weapon energy and set visible
            UIEnergyBars.Instance.SetImage(UIEnergyBars.EnergyBars.PlayerWeapon, UIEnergyBars.EnergyBarTypes.IceSlasher);
            UIEnergyBars.Instance.SetValue(UIEnergyBars.EnergyBars.PlayerWeapon, weaponEnergyValue);
            UIEnergyBars.Instance.SetVisibility(UIEnergyBars.EnergyBars.PlayerWeapon, true);
            break;
        }

        // apply the color changes
        colorSwap.ApplyColor();
    }
예제 #2
0
    private void ApplyMenuPalette()
    {
        // apply new selected color scheme with ColorSwap
        switch (menuPalette)
        {
        case MenuPalettes.Custom:
            // custom colors
            colorSwap.SwapColor((int)SwapIndex.Block1, ColorSwap.ColorFromInt(customColorBlockLight));
            colorSwap.SwapColor((int)SwapIndex.Block2, ColorSwap.ColorFromInt(customColorBlockDark));
            colorSwap.SwapColor((int)SwapIndex.Background, ColorSwap.ColorFromInt(customColorBackground));
            break;

        case MenuPalettes.BombMan:
            // light green, dark green, brown
            colorSwap.SwapColor((int)SwapIndex.Block1, ColorSwap.ColorFromInt(0x80D010));
            colorSwap.SwapColor((int)SwapIndex.Block2, ColorSwap.ColorFromInt(0x009400));
            colorSwap.SwapColor((int)SwapIndex.Background, ColorSwap.ColorFromInt(0x7C0800));
            break;

        case MenuPalettes.CutMan:
        case MenuPalettes.Wily3:
            // white, medium gray, dark gray
            colorSwap.SwapColor((int)SwapIndex.Block1, ColorSwap.ColorFromInt(0xFCFCFC));
            colorSwap.SwapColor((int)SwapIndex.Block2, ColorSwap.ColorFromInt(0xBCBCBC));
            colorSwap.SwapColor((int)SwapIndex.Background, ColorSwap.ColorFromInt(0x747474));
            break;

        case MenuPalettes.ElecMan:
        case MenuPalettes.Wily4:
            // white, orange, dark orange
            colorSwap.SwapColor((int)SwapIndex.Block1, ColorSwap.ColorFromInt(0xFCFCFC));
            colorSwap.SwapColor((int)SwapIndex.Block2, ColorSwap.ColorFromInt(0xFC9838));
            colorSwap.SwapColor((int)SwapIndex.Background, ColorSwap.ColorFromInt(0xC84C0C));
            break;

        case MenuPalettes.FireMan:
            // white, medium gray, dark red
            colorSwap.SwapColor((int)SwapIndex.Block1, ColorSwap.ColorFromInt(0xFCFCFC));
            colorSwap.SwapColor((int)SwapIndex.Block2, ColorSwap.ColorFromInt(0xBCBCBC));
            colorSwap.SwapColor((int)SwapIndex.Background, ColorSwap.ColorFromInt(0xA40000));
            break;

        case MenuPalettes.GutsMan:
            // pink, dark orange, brown
            colorSwap.SwapColor((int)SwapIndex.Block1, ColorSwap.ColorFromInt(0xFC7460));
            colorSwap.SwapColor((int)SwapIndex.Block2, ColorSwap.ColorFromInt(0xC84C0C));
            colorSwap.SwapColor((int)SwapIndex.Background, ColorSwap.ColorFromInt(0x7C0800));
            break;

        case MenuPalettes.IceMan:
            // white, dark green, teal
            colorSwap.SwapColor((int)SwapIndex.Block1, ColorSwap.ColorFromInt(0xFCFCFC));
            colorSwap.SwapColor((int)SwapIndex.Block2, ColorSwap.ColorFromInt(0x004400));
            colorSwap.SwapColor((int)SwapIndex.Background, ColorSwap.ColorFromInt(0x008088));
            break;

        case MenuPalettes.Wily1:
            // white, dark gray, blue
            colorSwap.SwapColor((int)SwapIndex.Block1, ColorSwap.ColorFromInt(0xFCFCFC));
            colorSwap.SwapColor((int)SwapIndex.Block2, ColorSwap.ColorFromInt(0x747474));
            colorSwap.SwapColor((int)SwapIndex.Background, ColorSwap.ColorFromInt(0x0000A8));
            break;

        case MenuPalettes.Wily2:
            // green, mustard, teal
            colorSwap.SwapColor((int)SwapIndex.Block1, ColorSwap.ColorFromInt(0x58F898));
            colorSwap.SwapColor((int)SwapIndex.Block2, ColorSwap.ColorFromInt(0x887000));
            colorSwap.SwapColor((int)SwapIndex.Background, ColorSwap.ColorFromInt(0x008088));
            break;

        case MenuPalettes.Wily4_1:
            // red, pink, black
            colorSwap.SwapColor((int)SwapIndex.Block1, ColorSwap.ColorFromInt(0xD82800));
            colorSwap.SwapColor((int)SwapIndex.Block2, ColorSwap.ColorFromInt(0xFC7460));
            colorSwap.SwapColor((int)SwapIndex.Background, ColorSwap.ColorFromInt(0x000000));
            break;

        case MenuPalettes.Wily4_2:
            // brown, light yellow, orange
            colorSwap.SwapColor((int)SwapIndex.Block1, ColorSwap.ColorFromInt(0x7C0800));
            colorSwap.SwapColor((int)SwapIndex.Block2, ColorSwap.ColorFromInt(0xFCD8A8));
            colorSwap.SwapColor((int)SwapIndex.Background, ColorSwap.ColorFromInt(0xC84C0C));
            break;
        }

        // apply the color changes
        colorSwap.ApplyColor();
    }