Exemplo n.º 1
0
    public override void _Ready()
    {
        instance         = this;
        CharacterSubMenu = GetNode <Control>(CharacterSubMenuPath);
        WeaponSlot       = GetNode <Control>(WeaponSlotPath);
        nameLabel        = GetNode <Label>(nameLabelPath);
        levelLabel       = GetNode <Label>(levelLabelPath);
        vitPoints        = GetNode <Label>(vitPointsPath);
        strPoints        = GetNode <Label>(strPointsPath);
        intPoints        = GetNode <Label>(intPointsPath);
        dexPoints        = GetNode <Label>(dexPointsPath);
        expBar           = GetNode <ColorRect>(expBarNodePath);
        hpLabel          = GetNode <Label>(hpLabelPath);
        paLabel          = GetNode <Label>(paLabelPath);
        maLabel          = GetNode <Label>(maLabelPath);
        asLabel          = GetNode <Label>(asLabelPath);
        unusedLabel      = GetNode <Label>(unusedLabelPath);
        defenseLabel     = GetNode <Label>(defenseLabelPath);
        hasteLabel       = GetNode <Label>(hasteLabelPath);

        _Hide();
    }
Exemplo n.º 2
0
    public void CharacterWindowSwitch(Hero hero, bool interactable)
    {
        if (EstateSceneState == EstateSceneState.ProvisionScreen)
        {
            return;
        }

        DarkestSoundManager.PlayOneShot("event:/ui/town/page_open");

        if (characterWindowOpened)
        {
            CharacterWindow.UpdateCharacterInfo(hero, interactable);
        }
        else
        {
            characterWindowOpened = true;
            CharacterWindow.gameObject.SetActive(true);
            CharacterWindow.UpdateCharacterInfo(hero, interactable);
            if (activityLogOpened)
            {
                ActivityLogClose();
            }
        }
    }
Exemplo n.º 3
0
    public void OpenCharacterWindow(Character source)
    {
        CharacterWindow window = WindowSystem.GetInstance().SwitchWindow(WindowType.CharacterWindow) as CharacterWindow;

        window.character = source;
    }
Exemplo n.º 4
0
        private void ButtonCharacter_Click(object sender, RoutedEventArgs e)
        {
            CharacterWindow characterWindow = new CharacterWindow(GameManager.Instance.PC);

            characterWindow.ShowDialog();
        }
Exemplo n.º 5
0
        public void OpenCharacters()
        {
            CharacterWindow characterWindow = new CharacterWindow();

            characterWindow.ShowDialog();
        }
Exemplo n.º 6
0
        //TODO: Change to customizable keybindings later
        private Keys[] KeyboardChange()
        {
            KeyboardState newState         = Input.CurrentKeyboardState;
            KeyboardState OldKeyboardState = Input.PreviousKeyboardState;
            List <Keys>   keys             = new List <Keys>();

            if (AbiliyCoolDown > 1)
            {
                foreach (var KeyBind in KeyBindContainer.KeyBinds)
                {
                    if (newState.IsKeyDown(KeyBind.BindedKey) && OldKeyboardState.IsKeyUp(KeyBind.BindedKey) && KeyBind.BindedAbilitityID != -1 && Scene.GetSceneComponent <ChannelBarComponent>() == null)
                    {
                        AbilityHead     ability = KeyBind.GetAbility();
                        MessageTemplate template;
                        ChannelTemplate ct = new ChannelTemplate(KeyBind.GetAbility().AbilityName, ChannelType.Ability);
                        if ((Scene as MainScene).UICanvas.Stage.FindAllElementsOfType <TargetWindow>() != null)
                        {
                            if (ability.ChannelTime > 0 && targeting)
                            {
                                template = new MessageTemplate(ct.ToJson(), MessageType.StartChanneling);
                                ChannelBarComponent channelBarComponent = new ChannelBarComponent(ability.ChannelTime, ability, Scene.FindEntitiesWithTag(2).ElementAt(0).GetComponent <PlayerComponent>().GetTarget(), Entity.Position);

                                Scene.AddSceneComponent(channelBarComponent);
                            }
                            else
                            {
                                template = new MessageTemplate(ct.ToJson(), MessageType.DamageTarget);
                            }
                            MessageManager.AddToQueue(template);
                            AbiliyCoolDown = 0;
                        }
                    }
                }
            }

            //Generated inventory
            if (newState.IsKeyDown(Keys.I) && OldKeyboardState.IsKeyUp(Keys.I))
            {
                if (!InventoryWindow.RemoveInventory(Scene))
                {
                    UIManager.GenerateInventoryWindow(skin, Scene, new Vector2(-1, -1), -1, -1);
                }
            }

            if (newState.IsKeyDown(Keys.C) && OldKeyboardState.IsKeyUp(Keys.C))
            {
                if (!CharacterWindow.RemoveCharacterWindow(Scene))
                {
                    UIManager.GenerateCharacterWindow(skin, Scene, new Vector2(-1, -1), -1, -1);
                }
            }

            if (newState.IsKeyDown(Keys.D1) && !OldKeyboardState.IsKeyDown(Keys.D1))
            {
            }
            if (newState.IsKeyDown(Keys.S) && !OldKeyboardState.IsKeyDown(Keys.S))
            {
                direction = Direction.Down;

                IsMoving = true;
            }
            if (newState.IsKeyDown(Keys.W) && !OldKeyboardState.IsKeyDown(Keys.W))
            {
                direction = Direction.Up;

                IsMoving = true;
            }
            if (newState.IsKeyDown(Keys.A) && !OldKeyboardState.IsKeyDown(Keys.A))
            {
                direction = Direction.Left;
                IsMoving  = true;
            }
            if (newState.IsKeyDown(Keys.D) && !OldKeyboardState.IsKeyDown(Keys.D))
            {
                direction = Direction.Right;
                IsMoving  = true;
            }
            if (newState.IsKeyDown(Keys.T) && !OldKeyboardState.IsKeyDown(Keys.T))
            {
                keys.Add(Keys.T);
            }
            if (IsMoving)
            {
                Scene.RemoveSceneComponent <ChannelBarComponent>();
            }

            return(keys.ToArray());
        }
Exemplo n.º 7
0
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(Settings.Default.LastFileName) && File.Exists(Settings.Default.LastFileName))
            {
                Load(Settings.Default.LastFileName);
            }

            #region Progress

            progressesCollection.Init(Progresses);

            progressesCollection.OnAdd = () =>
            {
                var progress = new Progress {
                    Start = DateTime.Now, Duration = TimeSpan.FromMinutes(83)
                };
                var result = new ProgressWindow(progress)
                {
                    Owner = this
                }.ShowDialog() == true;
                if (result)
                {
                    Progresses = Progresses.Add(progress);
                    return(progress);
                }
                return(null);
            };

            progressesCollection.OnEdit = obj =>
            {
                if (new ProgressWindow((Progress)obj)
                {
                    Owner = this
                }.ShowDialog() == true)
                {
                    SaveProgress();
                }
            };

            progressesCollection.OnRemove = obj =>
            {
                Progresses = Progresses.Remove((Progress)obj);
                return(true);
            };

            progressesCollection.OnOrder = obj => ((Progress)obj).Remain;

            var timer = new DispatcherTimer {
                Interval = TimeSpan.FromMinutes(1)
            };
            timer.Tick += (sender1, e1) => {
                progressesCollection.Refresh();
            };
            timer.Start();

            #endregion

            #region Characters

            charactersCollection.Init(Characters);

            charactersCollection.OnAdd = () =>
            {
                var character = new Character();
                var result    = new CharacterWindow(character)
                {
                    Owner = this
                }.ShowDialog() == true;
                if (result)
                {
                    Characters = Characters.Add(character);
                    return(character);
                }
                return(null);
            };

            charactersCollection.OnEdit = obj =>
            {
                if (new CharacterWindow((Character)obj)
                {
                    Owner = this
                }.ShowDialog() == true)
                {
                    SaveCharacters();
                }
            };

            charactersCollection.OnRemove = obj =>
            {
                Characters = Characters.Remove((Character)obj);
                return(true);
            };

            charactersCollection.OnOrder = obj => ((Character)obj).Remain;

            var timer2 = new DispatcherTimer {
                Interval = TimeSpan.FromMinutes(1)
            };
            timer2.Tick += (sender2, e2) =>
            {
                charactersCollection.Refresh();
            };
            timer2.Start();

            #endregion
        }
Exemplo n.º 8
0
        public void CreateCharacterWindow()
        {
            var characterWindow = new CharacterWindow();

            characterWindow.Show();
        }
Exemplo n.º 9
0
 private void Start()
 {
     characterWindow = GetComponent <CharacterWindow>();
 }
Exemplo n.º 10
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            ScreenService.Instance.GraphicsDevice.Viewport = ScreenService.Instance.DefaultScreenCamera.CurrentViewport;
            spriteBatch.Begin(
                SpriteSortMode.FrontToBack, // this is also the order for building the screen.
                null,
                SamplerState.PointClamp,
                null,
                null,
                null,
                ScreenService.Instance.DefaultScreenCamera.TransformMatrix);
            base.Draw(spriteBatch);

            if (!Images.Any())
            {
                Messages.Add("no image received from server");
            }
            foreach (var img in Images.ToList())
            {
                img.Draw(spriteBatch);
            }

            if (!InventoryImages.Any())
            {
                Messages.Add("no inventory image received from server");
            }
            foreach (var img in InventoryImages.ToList())
            {
                img.Draw(spriteBatch);
            }

            MultiplayerText.Draw(spriteBatch);
            HealthImage.Draw(spriteBatch);
            SpeedImage.Draw(spriteBatch);
            StrenghImage.Draw(spriteBatch);
            DialogImage.Draw(spriteBatch);
            CursorImage.Draw(spriteBatch);

            //LerpMouseImage.Draw(spriteBatch);

            if (InfoWindow?.IsVisible == true)
            {
                InfoWindow?.Draw(spriteBatch);
            }

            if (DialogWindow?.IsVisible == true)
            {
                DialogWindow?.Draw(spriteBatch);
            }

            if (InventoryWindow?.IsVisible == true)
            {
                InventoryWindow.Draw(spriteBatch);
            }

            if (CharacterWindow?.IsVisible == true)
            {
                MoneyCount.Draw(spriteBatch);
                CharacterWindow?.Draw(spriteBatch);
            }

            if (CharacterWindow?.IsVisible == true)
            {
                CharacterWindow?.Draw(spriteBatch);
            }

            if (ChatWindow?.IsVisible == true)
            {
                ChatWindow?.Draw(spriteBatch);
            }

            spriteBatch.End();
        }
Exemplo n.º 11
0
        /// <summary>
        /// Instantiate windows upon launch.
        /// </summary>
        public static void Initialize()
        {
            var gameWindow = new GameWindow(Constants.GameWidth, Constants.GameHeight)
            {
                IsFocused = true,
                IsVisible = true
            };

            Add(gameWindow);

            var characterWindow = new CharacterWindow(Constants.Windows.CharacterWidth, Constants.Windows.CharacterHeight)
            {
                IsVisible = false,
                IsFocused = false
            };

            Add(characterWindow);

            var statsWindow = new StatsWindow(Constants.Windows.StatsWidth, Constants.Windows.StatsHeight);

            Add(statsWindow);

            var inventoryWindow = new InventoryWindow(Constants.Windows.InventoryWidth, Constants.Windows.InventoryHeight)
            {
                IsVisible = false,
                IsFocused = false
            };

            Add(inventoryWindow);

            var previewWindow = new ItemPreviewWindow(Constants.Windows.ItemPreviewWidth, Constants.Windows.ItemPreviewHeight)
            {
                IsVisible = false,
                IsFocused = false
            };

            Add(previewWindow);

            var travelWindow = new TravelWindow(Constants.Windows.TravelWidth, Constants.Windows.TravelHeight)
            {
                IsVisible = false,
                IsFocused = false
            };

            Add(travelWindow);

            var messageWindow = new MessageWindow(Constants.Windows.MessageWidth, Constants.Windows.MessageHeight);

            Add(messageWindow);

            // Initialize last so all consoles are instantiated prior to creating keybinding bools for visibility
            var keybindingsWindow = new KeybindingsWindow(Constants.Windows.KeybindingsWidth, Constants.Windows.KeybindingsHeight);

            Add(keybindingsWindow);

            var generalKeybindingsWindow = new GeneralKeybindingsWindow(Constants.Windows.GeneralKeybindingsWidth, Constants.Windows.GeneralKeybindingsHeight);

            Add(generalKeybindingsWindow);

            var locationKeybindingsWindow = new LocationKeybindingsWindow(Constants.Windows.LocationKeybindingsWidth, Constants.Windows.LocationKeybindingsHeight);

            Add(locationKeybindingsWindow);

            var actionKeybindingsWindow = new ActionKeybindingsWindow(Constants.Windows.ActionKeybindingsWidth, Constants.Windows.ActionKeybindingsHeight);

            Add(actionKeybindingsWindow);


            // Action windows
            var choppingWindow = new ChoppingWindow(Constants.Windows.Actions.ChoppingWidth, Constants.Windows.Actions.ChoppingHeight)
            {
                IsVisible = false,
                IsFocused = false
            };

            Add(choppingWindow);

            var characterKeybindingsWindow = new CharacterKeybindingsWindow(Constants.Windows.CharacterKeybindingsWidth, Constants.Windows.CharacterKeybindingsHeight)
            {
                IsVisible = false
            };

            Add(characterKeybindingsWindow);

            IsInitialized = true;
        }