Пример #1
0
        private void actTokEditBtn_Click(object sender, EventArgs e)
        {
            foreach (TokenListItemControl ctrl in activeTokenFlowPanel.Controls)
            {
                if (ctrl.Selected)
                {
                    MapToken  mapToken  = ctrl.MapToken;
                    TokenData tokenData = mapToken.GetTokenData();

                    EditTokenForm charForm = new EditTokenForm(gameState);
                    charForm.SetTokenData(ref tokenData);
                    DialogResult result = charForm.ShowDialog(this);

                    if (result == DialogResult.OK)
                    {
                        tokenData = charForm.GetTokenData();
                        mapToken.SetTokenData(ref tokenData);
                    }

                    return;
                }
            }

            MessageBox.Show("No token selected.", "Error.", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Пример #2
0
        private void editLibTokenBtn_Click(object sender, EventArgs e)
        {
            int curSelectedIndex = tokenLibList.SelectedIndex;

            if (curSelectedIndex < 0)
            {
                MessageBox.Show("No token selected.", "Error.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            TokenData tokenData = gameState.TokenLibrary[(string)tokenLibList.SelectedItem];

            EditTokenForm charForm = new EditTokenForm(gameState);

            charForm.SetTokenData(ref tokenData);
            DialogResult result = charForm.ShowDialog(this);

            if (result == DialogResult.OK)
            {
                tokenData           = charForm.GetTokenData();
                tokenData.CurrentHP = tokenData.MaxHP;
                gameState.TokenLibrary[tokenData.Name] = tokenData;

                tokenData.SaveToLibrary();
            }
        }
        private void TokenImageBox_DoubleClick(object sender, EventArgs e)
        {
            TokenData tokenData = token.GetTokenData();

            EditTokenForm charForm = new EditTokenForm(token.GameState);

            charForm.SetTokenData(ref tokenData);
            DialogResult result = charForm.ShowDialog(this);

            if (result == DialogResult.OK)
            {
                tokenData = charForm.GetTokenData();
                token.SetTokenData(ref tokenData);
            }
        }