Esempio n. 1
0
        //-------------------------------------------------------------------------------
        #region btnOK_Click
        //-------------------------------------------------------------------------------
        //
        private void btnOK_Click(object sender, EventArgs e)
        {
            ExtractAndSetAllItems();
            bool b = ValueData.ValueDataDic.ContainsKey(SerializableTuple.Create(AbilityType.アーム, 1));

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
Esempio n. 2
0
        //-------------------------------------------------------------------------------
        #region -DisplayAllItems
        //-------------------------------------------------------------------------------
        //
        private void DisplayAllItems()
        {
            Action <IAbility, string, int[]> append_values = (ab, text, vals) =>
            {
                DataGridViewRow row = new DataGridViewRow();
                row.HeaderCell.Value = text;
                object[] vals__ = vals.Skip(1).Select(i => (object)i).ToArray();
                //row.SetValues(vals__);
                int index = dgvValues.Rows.Add(row);
                dgvValues.Rows[index].SetValues(vals__);
                dgvValues.Rows[index].Tag = ab;
            };
            Action <IAbility> append_default = ab => append_values(ab, ab.ToString(), new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0 });

            // ゴミだけ
            append_values(ゴミ.Get(), "", _valuedata.GarbageValues);

            // 特定アビリティ1つ付き
            var dic = _valuedata.ValueDataDic;

            foreach (var ab in Data.GetAllAbilitiesIncludedLevel())
            {
                AbilityType type  = Data.DIC_IABILITY_TO_ABILITYTYPE[ab];
                int         level = (ab is ILevel) ? (ab as ILevel).Level : 0;

                if (dic.ContainsKey(SerializableTuple.Create(type, level)))
                {
                    append_values(ab, ab.ToString(), dic[SerializableTuple.Create(type, level)]);
                }
                else
                {
                    append_default(ab);
                }
            }
        }
Esempio n. 3
0
        //-------------------------------------------------------------------------------
        #region -GetCostOfWeapon
        //-------------------------------------------------------------------------------
        //
        private static double GetCostOfWeapon(Weapon weapon, SynthesisWeapons[] synweps, SynthesisGeneralInfo synInfo)
        {
            if (synweps != null)
            {
                return(synweps.Where(swp => !Double.IsNaN(swp.cost))
                       .Min(swp => swp.cost));
            }
            else
            {
                IAbility ab          = weapon.FirstOrDefault(iab => !(iab is ゴミ));
                int      ability_num = weapon.AbilityNum;
                if (ab == null)
                {
                    return(synInfo.ValueData.GarbageValues[ability_num]);
                }
                else
                {
                    SerializableTuple <AbilityType, int> tuple;
                    if (ab is ILevel)
                    {
                        ILevel ab_lv = ab as ILevel;
                        tuple = SerializableTuple.Create(Data.DIC_IABILITY_TO_ABILITYTYPE[ab_lv.GetInstanceOfLv(1)], ab_lv.Level);
                    }
                    else
                    {
                        tuple = SerializableTuple.Create(Data.DIC_IABILITY_TO_ABILITYTYPE[ab], 0);
                    }

                    return((synInfo.ValueData.ValueDataDic.ContainsKey(tuple))
                            ? synInfo.ValueData.ValueDataDic[tuple][ability_num]
                            : Double.NaN);
                }
            }
        }
Esempio n. 4
0
        //-------------------------------------------------------------------------------
        #region -ExtractAndSetAllItems
        //-------------------------------------------------------------------------------
        //
        private void ExtractAndSetAllItems()
        {
            foreach (DataGridViewRow row in dgvValues.Rows)
            {
                int[] values       = new int[9];
                int[] input_values = GetRowIntValues(row);
                Array.Copy(input_values, 0, values, 1, 8);

                if (row.Tag is ゴミ)
                {
                    _valuedata.GarbageValues = values;
                }
                else
                {
                    IAbility ab = row.Tag as IAbility;
                    Debug.Assert(ab != null);

                    Action <AbilityType, int, int[]> updateDictionary = (a_ab, a_level, a_values) =>
                    {
                        var tuple = SerializableTuple.Create(a_ab, a_level);
                        if (_valuedata.ValueDataDic.ContainsKey(tuple))
                        {
                            _valuedata.ValueDataDic[tuple] = a_values;
                        }
                        else
                        {
                            _valuedata.ValueDataDic.Add(tuple, a_values);
                        }
                    };

                    if (ab is ILevel)
                    {
                        ILevel ab_lv = ab as ILevel;
                        updateDictionary(Data.DIC_IABILITY_TO_ABILITYTYPE[ab_lv.GetInstanceOfLv(1)], ab_lv.Level, values);
                    }
                    else
                    {
                        updateDictionary(Data.DIC_IABILITY_TO_ABILITYTYPE[ab], 0, values);
                    }
                }
            }
        }
Esempio n. 5
0
 public bool Equals(SerializableTuple <T1, T2> other)
 {
     return((_tuple != null && other._tuple != null) ? _tuple.Equals(other._tuple) : false);
 }