/// <summary> /// 还原默认槽位配置 /// </summary> public void RestSlotData() { CurrentSlotMap.Clear(); CurrentSpellMode = defaultSpellMode; foreach (KeyValuePair <int, SlotKeyCodeData> kv in defaultSlotMap) { SlotKeyCodeData data = new SlotKeyCodeData(kv.Value.nSlotIndex, kv.Value.nSlotType, kv.Value.nReleaseCondition, kv.Value.nAutoCasting, kv.Value.nFlag, kv.Value.szKeySequence, kv.Value.szSlotFunction); CurrentSlotMap.Add(kv.Key, data); } FuntionShortCutCtrl.GetInstance().ClearAndRest(); SetSlotData(true); }
private void LoadDefaultConfig(string stPath) { //走mpk包暂不判断文件 //if (!File.Exists(stPath)) //{ // Trace.Error("配置表:SlotMapedShortcut.csv 不存在!"); // return; //} ScpReader reader = new ScpReader(stPath, true, 2); for (int i = 0; i < reader.GetRecordCount(); i++) { SlotKeyCodeData sConfig = new SlotKeyCodeData(); sConfig.nSlotIndex = reader.GetInt(i, (int)DefaultShortcutsTableCol.SlotID, 0); sConfig.nSlotType = reader.GetInt(i, (int)DefaultShortcutsTableCol.SlotType, 0); sConfig.szKeySequence = reader.GetString(i, (int)DefaultShortcutsTableCol.ShortCutKey, ""); sConfig.nReleaseCondition = reader.GetInt(i, (int)DefaultShortcutsTableCol.ReleaseCondition, 0); sConfig.nAutoCasting = reader.GetInt(i, (int)DefaultShortcutsTableCol.SmartCast, 0); sConfig.nFlag = reader.GetInt(i, (int)DefaultShortcutsTableCol.Flag, 0); sConfig.szSlotFunction = reader.GetString(i, (int)DefaultShortcutsTableCol.FuncDesc, ""); int index = sConfig.nSlotType * m_maxSlotPerType + sConfig.nSlotIndex; if (defaultSlotMap.ContainsKey(index)) { defaultSlotMap[index] = sConfig; } else { defaultSlotMap.Add(index, sConfig); } } foreach (KeyValuePair <int, SlotKeyCodeData> kv in defaultSlotMap) { SlotKeyCodeData data = new SlotKeyCodeData(kv.Value.nSlotIndex, kv.Value.nSlotType, kv.Value.nReleaseCondition, kv.Value.nAutoCasting, kv.Value.nFlag, kv.Value.szKeySequence, kv.Value.szSlotFunction); CurrentSlotMap.Add(kv.Key, data); } }