} // End Method /// <summary> /// バインド項目を再読み込みします。 /// </summary> /// <param name="TableWeaponDataTable">Weapon Data Table</param> /// <param name="TableShieldDataTable">Shield Data Table</param> /// <param name="TableHelmetDataTable">Helmet Data Table</param> /// <param name="TableGauntletDataTable">Gauntlet Data Table</param> /// <param name="TableArmorDataTable">Armor Data Table</param> /// <param name="TableAccessoryDataTable">Accessory Data Table</param> public void ReloadDataTable(__table_weaponDataTable TableWeaponDataTable, __table_shieldDataTable TableShieldDataTable, __table_helmetDataTable TableHelmetDataTable, __table_gauntletDataTable TableGauntletDataTable, __table_armorDataTable TableArmorDataTable, __table_accessoryDataTable TableAccessoryDataTable) { dropInfoParts1.ReloadBindings(TableWeaponDataTable); dropInfoParts2.ReloadBindings(TableShieldDataTable); dropInfoParts3.ReloadBindings(TableHelmetDataTable); dropInfoParts4.ReloadBindings(TableGauntletDataTable); dropInfoParts5.ReloadBindings(TableArmorDataTable); dropInfoParts6.ReloadBindings(TableAccessoryDataTable); } // End Method
} // End Method //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // Pubilc Method //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- /// <summary> /// DataTableの設定をします。外部から引数を利用することでコントロール側に持ってこれることが判明。 /// </summary> /// <param name="TableUnitDataTable">Unit Data Table</param> /// <param name="TableWeaponDataTable">Weapon Data Table</param> /// <param name="TableShieldDataTable">Shield Data Table</param> /// <param name="TableHelmetDataTable">Helmet Data Table</param> /// <param name="TableGauntletDataTable">Gauntlet Data Table</param> /// <param name="TableArmorDataTable">Armor Data Table</param> /// <param name="TableAccessoryDataTable">Accessory Data Table</param> public void SetDataBindings(__table_unitDataTable TableUnitDataTable, __table_weaponDataTable TableWeaponDataTable, __table_shieldDataTable TableShieldDataTable, __table_helmetDataTable TableHelmetDataTable, __table_gauntletDataTable TableGauntletDataTable, __table_armorDataTable TableArmorDataTable, __table_accessoryDataTable TableAccessoryDataTable) { // データバインドの設定 // オーバーロードを利用して大体コピペで済むように dropInfoParts1.SetDataBindings(TableUnitDataTable, TableWeaponDataTable); dropInfoParts2.SetDataBindings(TableUnitDataTable, TableShieldDataTable); dropInfoParts3.SetDataBindings(TableUnitDataTable, TableHelmetDataTable); dropInfoParts4.SetDataBindings(TableUnitDataTable, TableGauntletDataTable); dropInfoParts5.SetDataBindings(TableUnitDataTable, TableArmorDataTable); dropInfoParts6.SetDataBindings(TableUnitDataTable, TableAccessoryDataTable); //---------------------------------------------------------------------------------------------------- // デザイナーの設定 Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right | AnchorStyles.Left); } // End Method
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // Property //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // Constructor Method //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- /// <summary> /// コンストラクタメソッド /// </summary> /// <param name="DataTable">Weapon Data Table</param> /// <param name="ElementDataTable">Element Data Table</param> public FormWeapon(__table_weaponDataTable DataTable, __table_elementDataTable ElementDataTable) { InitializeComponent(); // 割り当て。編集がリアルタイムに適応されるようになる WeaponDataTable = DataTable; // コンボボックスの設定 element1DataGridViewComboBoxColumn.DataSource = ElementDataTable.Copy(); element1DataGridViewComboBoxColumn.ValueMember = "ElementID"; element1DataGridViewComboBoxColumn.DisplayMember = "ElementName"; element2DataGridViewComboBoxColumn.DataSource = ElementDataTable.Copy(); element2DataGridViewComboBoxColumn.ValueMember = "ElementID"; element2DataGridViewComboBoxColumn.DisplayMember = "ElementName"; } // End Method
} // End Method //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // Pubilc Method //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------- #region Weapon /// <summary> /// DataTableの設定をします。外部から引数を利用することでコントロール側に持ってこれることが判明。 /// </summary> /// <param name="TableUnitDataTable">Unit Data Table</param> /// <param name="TableWeaponDataTable">Weapon Data Table</param> public void SetDataBindings(__table_unitDataTable TableUnitDataTable, __table_weaponDataTable TableWeaponDataTable) { // コンボボックスの設定 comboDropTable.DataSource = TableWeaponDataTable.Copy(); comboDropTable.DisplayMember = "WeaponName"; comboDropTable.ValueMember = "WeaponID"; //---------------------------------------------------------------------------------------------------- // データバインドの設定 comboDropTable.DataBindings.Add(new Binding("SelectedValue", TableUnitDataTable, "Item1", true)); numericDropRate.DataBindings.Add(new Binding("Value", TableUnitDataTable, "Per1", true)); //---------------------------------------------------------------------------------------------------- // デザイナーの設定 Anchor = (AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Left); } // End Method
} // End Method //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // Pubilc Method //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- /// <summary> /// DataTableの設定をします。外部から引数を利用することでコントロール側に持ってこれることが判明。 /// </summary> /// <param name="TableWeaponDataTable">Weapon Data Table</param> /// <param name="TableElementDataTable">Table Element Data Table</param> /// <param name="TableWeaponTypeDataTable">Weapon Type Data Table</param> public void SetDataBindings(__table_weaponDataTable TableWeaponDataTable, __table_elementDataTable TableElementDataTable, __table_weapon_typeDataTable TableWeaponTypeDataTable) { // データ項目の作成 // データ項目が少なく、わざわざデータベース化する必要のない項目 //-------------------------------------------------- // Target DataTable TargetDataTable = new DataTable(); TargetDataTable.Columns.Add("DataID", Type.GetType("System.Byte")); TargetDataTable.Columns.Add("DataName", Type.GetType("System.String")); // 項目配列。Listでもよかったかも...? byte[] TargetDataValue = new byte[] { 0, 1 }; string[] TargetDataName = new string[] { "単体", "全体" }; // 項目の構築 for (int i = 0; i < TargetDataValue.Length; i++) { DataRow row = TargetDataTable.NewRow(); // カラムにデータを割り当てる row["DataID"] = TargetDataValue[i]; row["DataName"] = TargetDataName[i]; // Debug文 Debug.WriteLine("Target Data Table Row Data:" + TargetDataValue[i] + "\t" + TargetDataName[i] + ";"); // 追加する TargetDataTable.Rows.Add(row); } // End Loop //-------------------------------------------------- // EType DataTable HandDataTable = new DataTable(); HandDataTable.Columns.Add("DataID", Type.GetType("System.Byte")); HandDataTable.Columns.Add("DataName", Type.GetType("System.String")); // 項目配列。Listでもよかったかも...? byte[] HandDataValue = new byte[] { 1, 2 }; string[] HandDataName = new string[] { "片手", "両手" }; // 項目の構築 for (int i = 0; i < HandDataValue.Length; i++) { DataRow row = HandDataTable.NewRow(); // カラムにデータを割り当てる row["DataID"] = HandDataValue[i]; row["DataName"] = HandDataName[i]; // Debug文 Debug.WriteLine("Hand Data Table Row Data:" + HandDataValue[i] + "\t" + HandDataName[i] + ";"); // 追加する HandDataTable.Rows.Add(row); } // End Loop //---------------------------------------------------------------------------------------------------- // コンボボックスの設定 comboEquipItemGroup.DataSource = TableWeaponTypeDataTable.Copy(); comboEquipItemGroup.DisplayMember = "WeaponTypeName"; comboEquipItemGroup.ValueMember = "WeaponTypeID"; comboAttackItemGroup.DataSource = TableWeaponTypeDataTable.Copy(); comboAttackItemGroup.DisplayMember = "WeaponTypeName"; comboAttackItemGroup.ValueMember = "WeaponTypeID"; comboTarget.DataSource = TargetDataTable; comboTarget.DisplayMember = "DataName"; comboTarget.ValueMember = "DataID"; comboEType.DataSource = HandDataTable; comboEType.DisplayMember = "DataName"; comboEType.ValueMember = "DataID"; //---------------------------------------------------------------------------------------------------- // データバインドの設定 // Weapon Data専用で必要なもの textItemID.DataBindings.Add(new Binding("Text", TableWeaponDataTable, "WeaponID", true)); textItemName.DataBindings.Add(new Binding("Text", TableWeaponDataTable, "WeaponName", true)); numericSPC.DataBindings.Add(new Binding("Value", TableWeaponDataTable, "SPC", true)); numericATC.DataBindings.Add(new Binding("Value", TableWeaponDataTable, "ATC", true)); comboEquipItemGroup.DataBindings.Add(new Binding("SelectedValue", TableWeaponDataTable, "Type", true)); comboAttackItemGroup.DataBindings.Add(new Binding("SelectedValue", TableWeaponDataTable, "AType", true)); comboTarget.DataBindings.Add(new Binding("SelectedValue", TableWeaponDataTable, "Target", true)); comboEType.DataBindings.Add(new Binding("SelectedValue", TableWeaponDataTable, "EType", true)); // 共通設定 CommonSettings(TableWeaponDataTable, TableElementDataTable); } // End Method