コード例 #1
0
        private void OnCellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (clearingTables || e.ColumnIndex == PARAMS_COLUMN_LOCK)
            {
                return;
            }
            DataGridView table = (DataGridView)sender;
            MaidInfo     maid  = SelectedMaid;

            if (SelectedMaid == null)
            {
                return;
            }

            MaidChangeType?type = null;

            if (table == dataGridView_params)
            {
                type = maidParamsTableDic[e.RowIndex];
            }
            else if (table == dataGridView_ero_zones)
            {
                type = maidEroTableDic[e.RowIndex];
            }
            else if (table == dataGridView_maid_params_bonus)
            {
                type = maidBonusStatsTableDic[e.RowIndex];
            }
            else if (table == dataGridView_statistics)
            {
                type = maidStatsTableDic[e.RowIndex];
            }
            if (type == null)
            {
                return;
            }

            if (valueUpdate[type.Value])
            {
                valueUpdate[type.Value] = false;
                return;
            }

            object val = table[e.ColumnIndex, e.RowIndex].Value;

            if (!(val is int) && !(val is long))
            {
                maid.UpdateField(type.Value);
                return;
            }

            if (maid.IsHardLocked(type.Value))
            {
                Debugger.WriteLine(
                    LogLevel.Info,
                    $"Value {EnumHelper.GetName(type.Value)} is locked! Unlocking temporarily...");
                maid.UnlockTemp(type.Value);
            }

            maid.SetValue(type.Value, val);
        }