/// <summary> /// 同名のカードをまとめる。 /// </summary> public static List <CardParam> PackCardParams(List <CardParam> idSortedData) { List <CardParam> ret = new List <CardParam> (); CardParam temp = new CardParam().Reset(); for (int i = 0; i < idSortedData.Count; i++) { CardParam cp = idSortedData [i]; if (cp.Atr == temp.Atr && cp.ID == temp.ID) { temp.Count += cp.Count; } else { //現在のデータで確定 if (temp.Atr == -1 || temp.ID == -1) { //-1,-1は無視する。 } else { ret.Add(temp); } temp = cp; } } return(ret); }
//強化に必要な枚数 public static int needPoint(CardParam cp) { // int[] ur = { 2, 4, 10 }; // int[] sr = { 2, 4, 10, 20 }; // int[] r = { 2, 4, 10, 20, 50 }; int[] n = { 2, 4, 10, 20, 50, 100 }; return(n [cp.LV - 1]); }
public CardData Set(CardParam _cp) { Atr = _cp.Atr; ID = _cp.ID; LV = _cp.LV; Count = _cp.Count; uid = _cp.uid; return(this); }
public bool Equals(CardParam other) { return(Equals(Voltage, other.Voltage) && Equals(TempLimit, other.TempLimit) && Equals(PowerLimit, other.PowerLimit) && Equals(CoreClock, other.CoreClock) && Equals(MemoryClock, other.MemoryClock) && Equals(FanSpeed, other.FanSpeed)); }
private static IEnumerable <CardParam> FindCards(ControlMemory ctlm) { const int divider = 1000; var cardCount = ctlm.GpuEntries.Length; var cards = new CardParam[cardCount]; for (uint i = 0; i < cardCount; i++) { var v1 = ctlm.GpuEntries[i]; var flags = v1.Flags; var voltageBoost = flags.HasFlag(MACM_SHARED_MEMORY_GPU_ENTRY_FLAG.CORE_VOLTAGE_BOOST); var voltage = new CardMinMaxCurrent { Current = voltageBoost ? v1.CoreVoltageBoostCur : (int)v1.CoreVoltageCur, Max = voltageBoost ? v1.CoreVoltageBoostMax : (int)v1.CoreVoltageMax, Min = voltageBoost ? v1.CoreVoltageBoostMin : (int)v1.CoreVoltageMin }; var templimit = new CardMinMaxCurrent { Current = v1.ThermalLimitCur, Max = v1.ThermalLimitMax, Min = v1.ThermalLimitMin }; var voltagelimit = new CardMinMaxCurrent { Current = v1.PowerLimitCur, Max = v1.PowerLimitMax, Min = v1.PowerLimitMin }; var coreclockBoost = flags.HasFlag(MACM_SHARED_MEMORY_GPU_ENTRY_FLAG.CORE_CLOCK_BOOST); var coreclock = new CardMinMaxCurrent { Current = coreclockBoost ? v1.CoreClockBoostCur / divider : (int)v1.CoreClockCur / divider, Max = coreclockBoost ? v1.CoreClockBoostMax / divider : (int)v1.CoreClockMax / divider, Min = coreclockBoost ? v1.CoreClockBoostMin / divider : (int)v1.CoreClockMin / divider }; var memoryclockBoost = flags.HasFlag(MACM_SHARED_MEMORY_GPU_ENTRY_FLAG.MEMORY_CLOCK_BOOST); var memoryclock = new CardMinMaxCurrent { Current = memoryclockBoost ? v1.MemoryClockBoostCur / divider : (int)v1.MemoryClockCur / divider, Max = memoryclockBoost ? v1.MemoryClockBoostMax / divider : (int)v1.MemoryClockMax / divider, Min = memoryclockBoost ? v1.MemoryClockBoostMin / divider : (int)v1.MemoryClockMin / divider }; var fancontrol = new CardMinMaxCurrent { Current = v1.FanSpeedCur, Max = v1.FanSpeedMax, Min = v1.FanSpeedMin }; var ismaster = v1.IsMaster; cards[i] = new CardParam(v1.Index, ismaster, voltage, templimit, voltagelimit, coreclock, memoryclock, fancontrol); } return(cards); }
public static List <CardParam> GetEnemyDeck(int _deckNum) { List <CardParam> ret = new List <CardParam> (); List <XLS_EnemyDeck.Param> paramList = DataManager.Instance.xls_EnemyDeck.sheets [_deckNum].list; for (int i = 0; i < paramList.Count; i++) { XLS_EnemyDeck.Param param = paramList [i]; CardParam cp = new CardParam().Set(param.cardAtr, param.cardID, param.cardLV, param.cardCount); ret.Add(cp); } return(ret); }
public static string GetSkillsText(CardParam _cp, ShowType _showType, bool _newLine, int _skillNum = -1) { List <string> skillsText = _cp.SkillTexts; List <string> skillsScript = _cp.SkillScript; List <int> Effects = _cp.Effect; List <int> EffectsValue = _cp.EffectValue; int lv = _cp.LV; string SkillStr = ""; for (int i = 0; i < Effects.Count; i++) { string text = SystemScript.GetEffectText(Effects[i], EffectsValue[i], _showType, _newLine, i == _skillNum); if (text != null) { if (SkillStr != "") //かいぎょう { SkillStr += "\n"; } SkillStr += text; //追加 } } for (int i = 0; i < skillsText.Count; i++) { string text = SystemScript.GetSkillText(skillsText[i], lv, _showType, _newLine, i == _skillNum); if (text != null) { if (SkillStr != "") //かいぎょう { SkillStr += "\n"; } SkillStr += text; //追加 if (skillsScript [i] == "") { SkillStr += "<color=#ff0000>(未実装)</color>"; } } } return(SkillStr); }
//カードシャッフル public static List <CardParam> ShuffleCP(List <CardParam> _lcp) { //とりあえず引き伸ばす List <CardParam> ret = new List <CardParam> (); for (int i = 0; i < _lcp.Count; i++) { CardParam cp = _lcp [i]; for (int i2 = 0; i2 < cp.Count; i2++) { CardParam x = new CardParam().Set(0, cp.ID, cp.LV, 1); ret.Add(x); } } for (int i = 0; i < ret.Count; i++) { CardParam temp = ret [i]; int randomIndex = Random.Range(0, ret.Count); ret [i] = ret [randomIndex]; ret [randomIndex] = temp; } return(ret); }
//カード情報の初期化 public void InitializeCardParam(cardColor color, int num) { _cardParam = new CardParam(color, num); }
public static Sprite GetCardSprite(CardParam _cp) { return(GetCardSprite(new CardData().Set(_cp))); }
private void RestoreCard(CardParam[] configCards, CardParam card) { const int divider = 1000; var messageBus = _messageBusFactory.Create(); try { if (card == null) { _logger.Error("card for restore is null!, ret <"); return; } var lmacm = new ControlMemory(); lmacm.Connect(); var configCardParam = configCards.FirstOrDefault(x => x.Id == card.Id); if (configCardParam == null) { if (_logger.IsDebugEnabled) { _logger.Debug($"Try restore card > {card} - error > not found in config"); } return; } var flags = lmacm.GpuEntries[card.Id].Flags; var voltageBoost = flags.HasFlag(MACM_SHARED_MEMORY_GPU_ENTRY_FLAG.CORE_VOLTAGE_BOOST); var coreclockBoost = flags.HasFlag(MACM_SHARED_MEMORY_GPU_ENTRY_FLAG.CORE_CLOCK_BOOST); var memoryclockBoost = flags.HasFlag(MACM_SHARED_MEMORY_GPU_ENTRY_FLAG.MEMORY_CLOCK_BOOST); lmacm.GpuEntries[card.Id].ThermalLimitCur = (int)configCardParam.TempLimit.Current; lmacm.GpuEntries[card.Id].PowerLimitCur = (int)configCardParam.PowerLimit.Current; lmacm.GpuEntries[card.Id].FanSpeedCur = (uint)configCardParam.FanSpeed.Current; if (voltageBoost) { lmacm.GpuEntries[card.Id].CoreVoltageBoostCur = (int)configCardParam.Voltage.Current; } else { lmacm.GpuEntries[card.Id].CoreVoltageCur = (uint)configCardParam.Voltage.Current; } if (coreclockBoost) { lmacm.GpuEntries[card.Id].CoreClockBoostCur = (int)configCardParam.CoreClock.Current * divider; } else { lmacm.GpuEntries[card.Id].CoreClockCur = (uint)configCardParam.CoreClock.Current * divider; } if (memoryclockBoost) { lmacm.GpuEntries[card.Id].MemoryClockBoostCur = (int)configCardParam.MemoryClock.Current * divider; } else { lmacm.GpuEntries[card.Id].MemoryClockCur = (uint)configCardParam.MemoryClock.Current * divider; } lmacm.CommitChanges(); lmacm.Disconnect(); if (_logger.IsWarnEnabled) { _logger.Warn($"Restore card > {card}"); } messageBus.Publish(new AutobernerWatchdogResetMessage { Status = MessageStatus.Ok }); } catch (Exception ex) { _logger.Error($"inner exception: {ex.InnerException.Message} > exception: {ex.Message}", ex); messageBus.Publish(new AutobernerWatchdogResetMessage { Status = MessageStatus.Error }); } }
public Card(CardParam param, int id) { Param = param; Id = id; }