Пример #1
0
    public void InitButtons()
    {
        foreach (var button in _buttons)
        {
            Destroy(button);
        }
        _buttons.Clear();

        GameObject buttonPrefab = Resources.Load <GameObject>("Prefabs/CharacterButton");

        float offset = 0f;

        foreach (var charData in CurrentUserManager.Instance.Characters)
        {
            GameObject instance = Object.Instantiate(buttonPrefab, this.transform);

            RectTransform recttr = instance.GetComponent <RectTransform>();
            recttr.anchoredPosition = new Vector2(recttr.anchoredPosition.x, offset);
            offset -= 35f;

            CharacterButton characterButton = instance.GetComponentInChildren <CharacterButton>();
            characterButton.Name = charData.Item1;
            characterButton.Code = charData.Item2;
            _buttons.Add(instance);
        }
    }
Пример #2
0
    public IEnumerator ShowCharacterButtons()
    {
        Vector2 offset = new Vector2(30, -30);

        for (int k = 0; k <= characterMatrix.GetLength(0) + characterMatrix.GetLength(1) - 2; k++)
        {
            for (int j = 0; j <= k; j++)
            {
                int i = k - j;
                if (i < characterMatrix.GetLength(0) && j < characterMatrix.GetLength(1))
                {
                    CharacterButton cb = characterMatrix[i, j];
                    if (cb != null)
                    {
                        cb.image.raycastTarget = true;
                        cb.image.color         = new Color(1, 1, 1, 0);
                        //cb.rectTransform.anchoredPosition = cb.rectTransform.anchoredPosition + offset;

                        //StartCoroutine(cb.MoveTo(cb.rectTransform.anchoredPosition - offset, 0.3f, 1));
                        StartCoroutine(cb.Fade(1, 0.3f, 1));
                    }
                }
            }

            //yield return new WaitForSeconds(0.05f);
        }
        yield return(new WaitForSeconds(0.3f));
    }
Пример #3
0
    new void Start()
    {
        buttons = new List <CharacterButton>();
        int i = 0;

        foreach (Character c in UnitRoster.Instance)
        {
            CharacterButton b = Instantiate <CharacterButton>(button);
            buttons.Add(b);
            RectTransform rc = b.GetComponent <RectTransform>();
            rc.SetParent(anchor);
            rc.localScale    = Vector3.one;
            rc.localPosition = new Vector3(0, i * -90);

            Height = i * 90 + 95;

            b.Label = c.Name;
            b.Register(Click, i);

            i++;
        }
        button.gameObject.SetActive(false);
        UpdateLevels();
        base.Start();
    }
Пример #4
0
		public void NotClickableWhenLetterRemoved()
		{
			var characterButton = new CharacterButton(0.5f, 0.5f, null);
			characterButton.Letter = 'S';
			characterButton.RemoveLetter();
			Assert.IsFalse(characterButton.IsClickable());
		}
Пример #5
0
		public void SettingCharactersSetsState()
		{
			var characterButton = new CharacterButton(0.5f, 0.5f, null);
			characterButton.Letter = 'S';
			characterButton.ShowLetter();
			Assert.IsTrue(characterButton.IsClickable());
			Assert.AreEqual("CharacterButton(0 - S)", characterButton.ToString());
		}
        public void NotClickableWhenLetterRemoved()
        {
            var characterButton = new CharacterButton(0.5f, 0.5f, null);

            characterButton.Letter = 'S';
            characterButton.RemoveLetter();
            Assert.IsFalse(characterButton.IsClickable());
        }
Пример #7
0
 /// <summary>
 /// Chargement des données des équipements
 /// </summary>
 /// <param name="data">Données de sauvegarde</param>
 private void LoadEquipment(SaveData data)
 {
     foreach (EquipmentData equipmentData in data.MyEquipmentData)
     {
         CharacterButton button = Array.Find(equipmentButtons, btn => btn.name.ToLower() == equipmentData.MyType.ToLower());
         button.EquipArmor(Array.Find(items, item => item.MyKey.ToLower() == equipmentData.MyKey.ToLower()) as Armor);
     }
 }
Пример #8
0
        public override void RefreshValues()
        {
            base.RefreshValues();

            CharacterButton.RefreshValues();
            NumberText.RefreshValues();
            Number.RefreshValues();
            InvalidText.RefreshValues();
        }
Пример #9
0
    private void LoadGear(SaveData data)
    {
        foreach (GearData gearData in data.MyGearData)
        {
            CharacterButton cb = Array.Find(gear, x => x.name == gearData.MyType);

            cb.EquipArmor(Array.Find(items, x => x.MyTitle == gearData.MyTitle) as Armor);
        }
    }
        public void SettingCharactersSetsState()
        {
            var characterButton = new CharacterButton(0.5f, 0.5f, null);

            characterButton.Letter = 'S';
            characterButton.ShowLetter();
            Assert.IsTrue(characterButton.IsClickable());
            Assert.AreEqual("CharacterButton(0 - S)", characterButton.ToString());
        }
Пример #11
0
    public void AddNewCharacterCreated(CharacterCreated characterCreated)
    {
        CharacterButton b = Instantiate(button);

        b.transform.SetParent(container);
        b.transform.localScale = Vector2.one;
        b.Init(this, characterCreated);
        id++;
        Refresh();
    }
    private void AddButtons()
    {
        Debug.Log("AddButtons" + itemList.Count.ToString());

        for (int i = 0; i < itemList.Count; i++)
        {
            CharacterButtonInfo item = itemList[i];
            Debug.Log("Button " + item.Name);
            GameObject newButton = buttonObjectPool.GetObject();
            newButton.transform.SetParent(contentPanel);

            CharacterButton sampleButton = newButton.GetComponent <CharacterButton>();
            sampleButton.Setup(item, this);
        }
    }
Пример #13
0
    void AddButtons()
    {
        int i;
        int numChar = unlockedCharacters.Count;

        for (i = 0; i < numChar; ++i)
        {
            // Use pool to get gameobject(do not always destroy)
            GameObject newButton = charButtonPool.GetObject();
            newButton.transform.SetParent(charSelectionScroll);

            // Setup button with character id
            CharacterButton charButton = newButton.GetComponent <CharacterButton>();
            string          spriteName = "char" + (i > 2 ? 0 : i).ToString() + "_main";
            Sprite          s          = spriteDictionary.charSpriteDic[spriteName];
            charButton.Setup(i, charLibrary.GetName(i), unlockedCharacters[i], this, s);
        }
    }
Пример #14
0
    public IEnumerator SelectCharacterAt(int id)
    {
        if (canChooseChar)
        {
            canChooseChar = false;
            if (selectorIndex != null && id >= 0)
            {
                CharacterButton cb = selectionScreen.characters[id];
                cb.button.interactable = false;
                playerSelectors[selectorIndex.Value].SetCharacter(cb.character);
                selectorIndex = null;
            }
            StartCoroutine(selectionScreen.FadeOutBackground());
            yield return(StartCoroutine(selectionScreen.HideCharacterButtons()));

            selectorIndex = null;
        }
    }
Пример #15
0
    public void AddVillager(GameObject villager)
    {
        UpdateValues(villager.GetComponent <BaseVillager>());

        CharacterButton button = Instantiate(characterPanel, panelParent.transform).GetComponent <CharacterButton>();

        button.SetVillager(villager);

        buttonList.Add(button.gameObject);

        if (buttonList.Count == 4)
        {
            parentEnd = new Vector3(parentEnd.x, parentEnd.y + 84, parentEnd.z);
        }
        else if (buttonList.Count > 4)
        {
            parentEnd = new Vector3(parentEnd.x, parentEnd.y + 168, parentEnd.z);
        }
    }
Пример #16
0
    public void CreateCharacterItem(Personality personality)
    {
        GameObject newChar = Instantiate(uiCharacterPrefab) as GameObject;

        CharacterButton charButton = newChar.GetComponent <CharacterButton> ();

        //Debug.LogWarning("Choosing "+persIdx);
        if (personality == null)
        {
            charButton.personality.SetupPersonality(PersonalityManager.PersonalityModel, selec[index]);
        }
        else
        {
            charButton.personality.CopyPersonality(personality);
        }

        // Modify UICharacter in itemList
        charButton.personality.TraitsEffect();

        newChar.transform.SetParent(contentPanel);
    }
Пример #17
0
        public SelectScreen2(int width, int height, IScreenMaster master)
            : base(width, height, master)
        {
            input = Settings.in2;

            Texture2D  up   = Load <Texture2D>("Image/buttonUp");
            Texture2D  down = Load <Texture2D>("Image/buttonDown");
            SpriteFont font = Load <SpriteFont>("Font/text");

            int centerX = widthScreen / 2 - up.Width / 2;

            ColorRect c = new ColorRect(0, 0, widthScreen, heightScreen, Color.Black);

            bg = c;

            Label t = new Label(widthScreen / 2, 10, font, "P2, Select Character");

            t.x  -= (int)t.GetDim().X / 2;
            title = t;

            Button back = new TextButton(centerX, heightScreen - up.Height - 10, up, down, font, "Back");

            back.select += delegate() { ChangeScreen <SelectScreen1>(); };



            CharacterButton wasp = new CharacterButton(100, 100, LoadAnim("waspIdle"), up, down);

            wasp.select += delegate() { Settings.P2_FIGHTER = "wasp"; ChangeScreen <GameScreen>(); };
            buttons.Add(wasp);

            CharacterButton beetle = new CharacterButton(180, 100, LoadAnim("beetleIdle"), up, down);

            beetle.select += delegate() { Settings.P2_FIGHTER = "beetle"; ChangeScreen <GameScreen>(); };
            buttons.Add(beetle);
            buttons.Add(back);
        }
Пример #18
0
        public SelectScene(List<SelectInfo> characters)
        {
            SoundManager.PlaySound(SoundList.SelectMusic, true);
            Disposing += (o, e) => SoundManager.StopSound(SoundList.SelectMusic);


            Characters = characters;
            SortList();

            KeyPress +=SelectScene_KeyPress;

            Background = new MirImageControl
            {
                Index = 64,
                Library = Libraries.Prguse,
                Parent = this,
            };

            Title = new MirImageControl
            {
                Index = 40,
                Library = Libraries.Title,
                Parent = this,
                Location = new Point(364, 12)
            };

            ServerLabel = new MirLabel
                {
                    Location = new Point(322, 44),
                    Parent = Background,
                    Size = new Size(155, 17),
                    Text = "Legend of Mir 2",
                    DrawFormat = TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter
                };
            
            StartGameButton = new MirButton
            {
                Enabled = false,
                HoverIndex = 341,
                Index = 340,
                Library = Libraries.Title,
                Location = new Point(110, 568),
                Parent = Background,
                PressedIndex = 342
            };
            StartGameButton.Click += (o, e) => StartGame();

            NewCharacterButton = new MirButton
                {
                    HoverIndex = 344,
                    Index = 343,
                    Library = Libraries.Title,
                    Location = new Point(230, 568),
                    Parent = Background,
                    PressedIndex = 345,
                    GrayScale = true
                };
            NewCharacterButton.Click += (o, e) => _character = new NewCharacterDialog { Parent = this };

            DeleteCharacterButton = new MirButton
            {
                HoverIndex = 347,
                Index = 346,
                Library = Libraries.Title,
                Location = new Point(350, 568),
                Parent = Background,
                PressedIndex = 348
            };
            DeleteCharacterButton.Click += (o, e) => DeleteCharacter();


            CreditsButton = new MirButton
            {
                HoverIndex = 350,
                Index = 349,
                Library = Libraries.Title,
                Location = new Point(470, 568),
                Parent = Background,
                PressedIndex = 351
            };

            ExitGame = new MirButton
            {
                HoverIndex = 353,
                Index = 352,
                Library = Libraries.Title,
                Location = new Point(590, 568),
                Parent = Background,
                PressedIndex = 354
            };
            ExitGame.Click += (o, e) => Program.Form.Close();


            CharacterDisplay = new MirAnimatedControl
            {
                Animated = true,
                AnimationCount = 16,
                AnimationDelay = 250,
                FadeIn = true,
                FadeInDelay = 75,
                FadeInRate = 0.1F,
                Index = 220,
                Library = Libraries.ChrSel,
                Location = new Point(200, 300),
                Parent = Background,
                UseOffSet = true,
                Visible = false
            };
            CharacterDisplay.AfterDraw += (o, e) =>
            {
               // if (_selected >= 0 && _selected < Characters.Count && characters[_selected].Class == MirClass.Wizard)
                    Libraries.ChrSel.DrawBlend(CharacterDisplay.Index + 560, CharacterDisplay.DisplayLocationWithoutOffSet, Color.White, true);
            };
            
            CharacterButtons = new CharacterButton[4];

            CharacterButtons[0] = new CharacterButton
            {
                Location = new Point(447, 122),
                Parent = Background,
                Sound = SoundList.ButtonA,
            };
            CharacterButtons[0].Click += (o,e) =>
            {
                if (characters.Count <= 0) return;

                _selected = 0;
                UpdateInterface();
            };

            CharacterButtons[1] = new CharacterButton
            {
                Location = new Point(447, 226),
                Parent = Background,
                Sound = SoundList.ButtonA,
            };
            CharacterButtons[1].Click += (o, e) =>
            {
                if (characters.Count <= 1) return;
                _selected = 1;
                UpdateInterface();
            };

            CharacterButtons[2] = new CharacterButton
            {
                Location = new Point(447, 330),
                Parent = Background,
                Sound = SoundList.ButtonA,
            };
            CharacterButtons[2].Click += (o, e) =>
            {
                if (characters.Count <= 2) return;

                _selected = 2;
                UpdateInterface();
            };

            CharacterButtons[3] = new CharacterButton
            {
                Location = new Point(447, 434),
                Parent = Background,
                Sound = SoundList.ButtonA,
            };
            CharacterButtons[3].Click += (o, e) =>
            {
                if (characters.Count <= 3) return;

                _selected = 3;
                UpdateInterface();
            };

            LastAccessLabel = new MirLabel
            {
                Location = new Point(140, 509),
                Parent = Background,
                Size = new Size(180, 21),
                DrawFormat = TextFormatFlags.Left | TextFormatFlags.VerticalCenter,
                Border = true,
            };
            LastAccessLabelLabel = new MirLabel
                {
                    Location = new Point(-80, -1),
                    Parent = LastAccessLabel,
                    Text = "Last Online:",
                    Size = new Size(100, 21),
                    DrawFormat = TextFormatFlags.Left | TextFormatFlags.VerticalCenter,
                    Border = true,
                };
            UpdateInterface();
        }
Пример #19
0
        public SelectScene(List <SelectInfo> characters)
        {
            SoundManager.PlaySound(SoundList.SelectMusic, true);
            Disposing += (o, e) => SoundManager.StopSound(SoundList.SelectMusic);


            Characters = characters;
            SortList();

            KeyPress += SelectScene_KeyPress;

            Background = new MirImageControl
            {
                Index   = 64,
                Library = Libraries.Prguse,
                Parent  = this,
            };

            Title = new MirImageControl
            {
                Index    = 40,
                Library  = Libraries.Title,
                Parent   = this,
                Location = new Point(364, 12)
            };

            ServerLabel = new MirLabel
            {
                Location   = new Point(322, 44),
                Parent     = Background,
                Size       = new Size(155, 17),
                Text       = GameLanguage.GameName,
                DrawFormat = TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter
            };

            StartGameButton = new MirButton
            {
                Enabled      = false,
                HoverIndex   = 341,
                Index        = 340,
                Library      = Libraries.Title,
                Location     = new Point(110, 568),
                Parent       = Background,
                PressedIndex = 342,
                GrayScale    = true
            };
            StartGameButton.Click += (o, e) => StartGame();

            NewCharacterButton = new MirButton
            {
                HoverIndex   = 344,
                Index        = 343,
                Library      = Libraries.Title,
                Location     = new Point(230, 568),
                Parent       = Background,
                PressedIndex = 345,
            };
            NewCharacterButton.Click += (o, e) => _character = new NewCharacterDialog {
                Parent = this
            };

            DeleteCharacterButton = new MirButton
            {
                HoverIndex   = 347,
                Index        = 346,
                Library      = Libraries.Title,
                Location     = new Point(350, 568),
                Parent       = Background,
                PressedIndex = 348
            };
            DeleteCharacterButton.Click += (o, e) => DeleteCharacter();


            CreditsButton = new MirButton
            {
                HoverIndex   = 350,
                Index        = 349,
                Library      = Libraries.Title,
                Location     = new Point(470, 568),
                Parent       = Background,
                PressedIndex = 351
            };

            ExitGame = new MirButton
            {
                HoverIndex   = 353,
                Index        = 352,
                Library      = Libraries.Title,
                Location     = new Point(590, 568),
                Parent       = Background,
                PressedIndex = 354
            };
            ExitGame.Click += (o, e) => Program.Form.Close();


            CharacterDisplay = new MirAnimatedControl
            {
                Animated       = true,
                AnimationCount = 16,
                AnimationDelay = 250,
                FadeIn         = true,
                FadeInDelay    = 75,
                FadeInRate     = 0.1F,
                Index          = 220,
                Library        = Libraries.ChrSel,
                Location       = new Point(200, 300),
                Parent         = Background,
                UseOffSet      = true,
                Visible        = false
            };
            CharacterDisplay.AfterDraw += (o, e) =>
            {
                // if (_selected >= 0 && _selected < Characters.Count && characters[_selected].Class == MirClass.Wizard)
                Libraries.ChrSel.DrawBlend(CharacterDisplay.Index + 560, CharacterDisplay.DisplayLocationWithoutOffSet, Color.White, true);
            };

            CharacterButtons = new CharacterButton[4];

            CharacterButtons[0] = new CharacterButton
            {
                Location = new Point(447, 122),
                Parent   = Background,
                Sound    = SoundList.ButtonA,
            };
            CharacterButtons[0].Click += (o, e) =>
            {
                if (characters.Count <= 0)
                {
                    return;
                }

                _selected = 0;
                UpdateInterface();
            };

            CharacterButtons[1] = new CharacterButton
            {
                Location = new Point(447, 226),
                Parent   = Background,
                Sound    = SoundList.ButtonA,
            };
            CharacterButtons[1].Click += (o, e) =>
            {
                if (characters.Count <= 1)
                {
                    return;
                }
                _selected = 1;
                UpdateInterface();
            };

            CharacterButtons[2] = new CharacterButton
            {
                Location = new Point(447, 330),
                Parent   = Background,
                Sound    = SoundList.ButtonA,
            };
            CharacterButtons[2].Click += (o, e) =>
            {
                if (characters.Count <= 2)
                {
                    return;
                }

                _selected = 2;
                UpdateInterface();
            };

            CharacterButtons[3] = new CharacterButton
            {
                Location = new Point(447, 434),
                Parent   = Background,
                Sound    = SoundList.ButtonA,
            };
            CharacterButtons[3].Click += (o, e) =>
            {
                if (characters.Count <= 3)
                {
                    return;
                }

                _selected = 3;
                UpdateInterface();
            };

            LastAccessLabel = new MirLabel
            {
                Location   = new Point(140, 509),
                Parent     = Background,
                Size       = new Size(180, 21),
                DrawFormat = TextFormatFlags.Left | TextFormatFlags.VerticalCenter,
                Border     = true,
            };
            LastAccessLabelLabel = new MirLabel
            {
                Location   = new Point(-80, -1),
                Parent     = LastAccessLabel,
                Text       = GameLanguage.LastOnline,
                Size       = new Size(100, 21),
                DrawFormat = TextFormatFlags.Left | TextFormatFlags.VerticalCenter,
                Border     = true,
            };
            UpdateInterface();
        }
Пример #20
0
        public SelectScene(List <SelectInfo> characters)
        {
            SoundManager.PlaySound(SoundList.SelectMusic, true);
            Disposing += (o, e) => SoundManager.StopSound(SoundList.SelectMusic);

            Characters = characters;
            SortList();

            KeyPress += SelectScene_KeyPress;

            Background = new MirImageControl
            {
                Index   = 65,
                Library = Libraries.Prguse,
                Parent  = this,
            };

            Title = new MirImageControl
            {
                Index    = 40,
                Library  = Libraries.Title,
                Parent   = this,
                Location = new Point(468, 20)
            };

            ServerLabel = new MirLabel
            {
                Location = new Point(432, 60),
                // Location = new Point(322, 44),
                Parent     = Background,
                Size       = new Size(155, 17),
                Text       = "Legend of Mir 2",
                DrawFormat = TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter
            };

            var xPoint = ((Settings.ScreenWidth - 200) / 5);

            StartGameButton = new MirButton
            {
                Enabled      = false,
                HoverIndex   = 341,
                Index        = 340,
                Library      = Libraries.Title,
                Location     = new Point(100 + (xPoint * 1) - (xPoint / 2) - 50, Settings.ScreenHeight - 32),
                Parent       = Background,
                PressedIndex = 342
            };
            StartGameButton.Click += (o, e) => StartGame();

            NewCharacterButton = new MirButton
            {
                HoverIndex   = 344,
                Index        = 343,
                Library      = Libraries.Title,
                Location     = new Point(100 + (xPoint * 2) - (xPoint / 2) - 50, Settings.ScreenHeight - 32),
                Parent       = Background,
                PressedIndex = 345,
            };
            NewCharacterButton.Click += (o, e) => _character = new NewCharacterDialog {
                Parent = this
            };

            DeleteCharacterButton = new MirButton
            {
                HoverIndex   = 347,
                Index        = 346,
                Library      = Libraries.Title,
                Location     = new Point(100 + (xPoint * 3) - (xPoint / 2) - 50, Settings.ScreenHeight - 32),
                Parent       = Background,
                PressedIndex = 348
            };
            DeleteCharacterButton.Click += (o, e) => DeleteCharacter();


            CreditsButton = new MirButton
            {
                HoverIndex   = 350,
                Index        = 349,
                Library      = Libraries.Title,
                Location     = new Point(100 + (xPoint * 4) - (xPoint / 2) - 50, Settings.ScreenHeight - 32),
                Parent       = Background,
                PressedIndex = 351
            };
            CreditsButton.Click += (o, e) =>
            {
            };

            ExitGame = new MirButton
            {
                HoverIndex   = 353,
                Index        = 352,
                Library      = Libraries.Title,
                Location     = new Point(100 + (xPoint * 5) - (xPoint / 2) - 50, Settings.ScreenHeight - 32),
                Parent       = Background,
                PressedIndex = 354
            };
            ExitGame.Click += (o, e) => Program.Form.Close();


            CharacterDisplay = new MirAnimatedControl
            {
                Animated       = true,
                AnimationCount = 16,
                AnimationDelay = 250,
                FadeIn         = true,
                FadeInDelay    = 75,
                FadeInRate     = 0.1F,
                Index          = 220,
                Library        = Libraries.ChrSel,
                Location       = new Point(260, 420),
                Parent         = Background,
                UseOffSet      = true,
                Visible        = false
            };
            CharacterDisplay.AfterDraw += (o, e) =>
            {
                // if (_selected >= 0 && _selected < Characters.Count && characters[_selected].Class == MirClass.Wizard)
                Libraries.ChrSel.DrawBlend(CharacterDisplay.Index + 560, CharacterDisplay.DisplayLocationWithoutOffSet, Color.White, true);
            };

            CharacterButtons = new CharacterButton[4];

            CharacterButtons[0] = new CharacterButton
            {
                Location = new Point(637, 194),
                Parent   = Background,
                Sound    = SoundList.ButtonA,
            };
            CharacterButtons[0].Click += (o, e) =>
            {
                if (characters.Count <= 0)
                {
                    return;
                }

                _selected = 0;
                UpdateInterface();
            };

            CharacterButtons[1] = new CharacterButton
            {
                Location = new Point(637, 298),
                Parent   = Background,
                Sound    = SoundList.ButtonA,
            };
            CharacterButtons[1].Click += (o, e) =>
            {
                if (characters.Count <= 1)
                {
                    return;
                }
                _selected = 1;
                UpdateInterface();
            };

            CharacterButtons[2] = new CharacterButton
            {
                Location = new Point(637, 402),
                Parent   = Background,
                Sound    = SoundList.ButtonA,
            };
            CharacterButtons[2].Click += (o, e) =>
            {
                if (characters.Count <= 2)
                {
                    return;
                }

                _selected = 2;
                UpdateInterface();
            };

            CharacterButtons[3] = new CharacterButton
            {
                Location = new Point(637, 506),
                Parent   = Background,
                Sound    = SoundList.ButtonA,
            };
            CharacterButtons[3].Click += (o, e) =>
            {
                if (characters.Count <= 3)
                {
                    return;
                }

                _selected = 3;
                UpdateInterface();
            };

            LastAccessLabel = new MirLabel
            {
                Location   = new Point(265, 609),
                Parent     = Background,
                Size       = new Size(180, 21),
                DrawFormat = TextFormatFlags.Left | TextFormatFlags.VerticalCenter,
                Border     = true,
            };
            LastAccessLabelLabel = new MirLabel
            {
                Location   = new Point(-65, 0),
                Parent     = LastAccessLabel,
                Text       = "Last Online:",
                Size       = new Size(100, 21),
                DrawFormat = TextFormatFlags.Left | TextFormatFlags.VerticalCenter,
                Border     = true,
            };
            UpdateInterface();
            Program.discord.UpdateStage(StatusType.GameState, GameState.SelectingCharacter);
            Program.discord.UpdateActivity();
        }
Пример #21
0
        public SelectScene(List <SelectInfo> characters)
        {
            SoundManager.PlaySound(SoundList.SelectMusic, true);
            Disposing += (o, e) => SoundManager.StopSound(SoundList.SelectMusic);

            Characters = characters;
            SortList();

            KeyPress += SelectScene_KeyPress;

            Background = new MirImageControl
            {
                Index   = 65,
                Library = Libraries.Prguse,
                Parent  = this,
            };

            Title = new MirImageControl
            {
                Index    = 40,
                Library  = Libraries.Title,
                Parent   = this,
                Location = new Point(600, 20)   //标题栏图片左侧边缘距离左侧边框位置
            };

            ServerLabel = new MirLabel
            {
                Location = new Point(560, 60),   //选择人物界面上方标题栏位置1280X768位置
                // Location = new Point(432, 60),//选择人物界面上方标题栏位置1024X768大小时位置(432, 60)为左右中心.公式=分辨率宽度/2-80
                Parent     = Background,
                Size       = new Size(155, 17),
                Text       = "热血无限国际传奇Ⅱ", //人物创建选择界面上方游戏标题
                DrawFormat = TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter
            };

            var xPoint = ((Settings.ScreenWidth - 200) / 5);  //底部按钮左右均分位置

            StartGameButton = new MirButton
            {
                Enabled      = false,
                HoverIndex   = 341,
                Index        = 340,
                Library      = Libraries.Title,
                Location     = new Point(100 + (xPoint * 1) - (xPoint / 2) - 50, Settings.ScreenHeight - 32),
                Parent       = Background,
                PressedIndex = 342
            };
            StartGameButton.Click += (o, e) => StartGame();

            NewCharacterButton = new MirButton
            {
                HoverIndex   = 344,
                Index        = 343,
                Library      = Libraries.Title,
                Location     = new Point(100 + (xPoint * 2) - (xPoint / 2) - 50, Settings.ScreenHeight - 32),
                Parent       = Background,
                PressedIndex = 345,
            };
            NewCharacterButton.Click += (o, e) => _character = new NewCharacterDialog {
                Parent = this
            };

            DeleteCharacterButton = new MirButton
            {
                HoverIndex   = 347,
                Index        = 346,
                Library      = Libraries.Title,
                Location     = new Point(100 + (xPoint * 3) - (xPoint / 2) - 50, Settings.ScreenHeight - 32),
                Parent       = Background,
                PressedIndex = 348
            };
            DeleteCharacterButton.Click += (o, e) => DeleteCharacter();


            CreditsButton = new MirButton
            {
                HoverIndex   = 350,
                Index        = 349,
                Library      = Libraries.Title,
                Location     = new Point(100 + (xPoint * 4) - (xPoint / 2) - 50, Settings.ScreenHeight - 32),
                Parent       = Background,
                PressedIndex = 351
            };
            CreditsButton.Click += (o, e) =>
            {
            };

            ExitGame = new MirButton
            {
                HoverIndex   = 353,
                Index        = 352,
                Library      = Libraries.Title,
                Location     = new Point(100 + (xPoint * 5) - (xPoint / 2) - 50, Settings.ScreenHeight - 32),
                Parent       = Background,
                PressedIndex = 354
            };
            ExitGame.Click += (o, e) => Program.Form.Close();


            CharacterDisplay = new MirAnimatedControl   //选择人物展示动画
            {
                Animated       = true,
                AnimationCount = 16,  //动画图片数量
                AnimationDelay = 150, //动画延时250默认
                FadeIn         = true,
                FadeInDelay    = 275, //淡入淡出延时75默认
                FadeInRate     = 0.1F,
                Index          = 220,
                Library        = Libraries.ChrSel,
                Location       = new Point(360, 450), //动画位置(距离左侧距离260, 距离顶部距离420)默认(260, 420)
                Parent         = Background,
                UseOffSet      = true,
                Visible        = false
            };
            CharacterDisplay.AfterDraw += (o, e) =>
            {
                // if (_selected >= 0 && _selected < Characters.Count && characters[_selected].Class == MirClass.Wizard)
                Libraries.ChrSel.DrawBlend(CharacterDisplay.Index + 560, CharacterDisplay.DisplayLocationWithoutOffSet, Color.White, true);
            };

            CharacterButtons = new CharacterButton[4];//人物选择按钮创建4个 CharacterButton[4]

            CharacterButtons[0] = new CharacterButton
            {
                Location = new Point(637, 194),  //人物选择按钮位置
                Parent   = Background,
                Sound    = SoundList.ButtonA,
            };
            CharacterButtons[0].Click += (o, e) =>
            {
                if (characters.Count <= 0)
                {
                    return;
                }

                _selected = 0;
                UpdateInterface();
            };

            CharacterButtons[1] = new CharacterButton
            {
                Location = new Point(637, 298),
                Parent   = Background,
                Sound    = SoundList.ButtonA,
            };
            CharacterButtons[1].Click += (o, e) =>
            {
                if (characters.Count <= 1)
                {
                    return;
                }
                _selected = 1;
                UpdateInterface();
            };

            CharacterButtons[2] = new CharacterButton
            {
                Location = new Point(637, 402),
                Parent   = Background,
                Sound    = SoundList.ButtonA,
            };
            CharacterButtons[2].Click += (o, e) =>
            {
                if (characters.Count <= 2)
                {
                    return;
                }

                _selected = 2;
                UpdateInterface();
            };

            CharacterButtons[3] = new CharacterButton
            {
                Location = new Point(637, 506),
                Parent   = Background,
                Sound    = SoundList.ButtonA,
            };
            CharacterButtons[3].Click += (o, e) =>
            {
                if (characters.Count <= 3)
                {
                    return;
                }

                _selected = 3;
                UpdateInterface();
            };

            LastAccessLabel = new MirLabel  //205行起始
            {
                Location   = new Point(265, 609),
                Parent     = Background,
                Size       = new Size(180, 21),
                DrawFormat = TextFormatFlags.Left | TextFormatFlags.VerticalCenter,
                Border     = true,
            };
            LastAccessLabelLabel = new MirLabel
            {
                Location   = new Point(-65, 0),
                Parent     = LastAccessLabel,
                Text       = "上次在线:",
                Size       = new Size(100, 21),
                DrawFormat = TextFormatFlags.Left | TextFormatFlags.VerticalCenter,
                Border     = true,
            };
            UpdateInterface();
        }
Пример #22
0
 public void Deselect()
 {
     selectedActor  = null;
     selectedButton = null;
 }