public void Renew(string contents, string purchaseText, int level, double value, double cost, double time, eValueType elemType = eValueType.Expo) { mLevelText.text = "LV. " + level.ToString(); string valueStr = ""; switch (elemType) { case eValueType.Percent: valueStr = (value * 100).ToString("N0") + "%"; break; case eValueType.Numeric: case eValueType.Expo: valueStr = UnitBuilder.GetUnitStr(value); break; default: Debug.LogError("wrong value type : " + elemType); break; } mContentsText.text = string.Format(contents, UnitBuilder.GetUnitStr(value), time.ToString("N1")); mCostText.text = UnitBuilder.GetUnitStr(cost); mPurchaseText.text = purchaseText; }
/// <summary> /// 某类变化,单独计算 /// </summary> /// <param name="eType"></param> public void CalcChangeValue(eValueType eType) { //CalcChangeType(eType); //switch (eType) //{ // case eValueType.BaseRole: // CalcBaseRoleValue(); // break; // case eValueType.Equip: // CalcEquipValue(); // break; // case eValueType.Gem: // CalcGemValue(); // break; // case eValueType.Buff: // CalcBuffValue(); // break; // case eValueType.Skill: // CalcSkillValue(); // break; // default: // break; //} //CalcPointToValue(); //_CalcFinalValue(); }
private void SetType(Type _type) { if (_type == typeof(ulong)) { _valueType = eValueType.xsULong; } else if (_type == typeof(uint)) { _valueType = eValueType.xsUInteger; } else if (_type == typeof(int)) { _valueType = eValueType.xsInteger; } else if (_type == typeof(long)) { _valueType = eValueType.xsLong; } else if (_type == typeof(double)) { _valueType = eValueType.xsDouble; } else if (_type == typeof(float)) { _valueType = eValueType.xsFloat; } else if (_type == typeof(string)) { _valueType = eValueType.xsString; } }
/// <summary> /// 删除 /// </summary> /// <param name="value"></param> public void Remove(float value, eValueType type) { CPropertyValue cp = Find(value, type); if (cp != null) { cp.Unlink(); } }
private float m_MinData; //最小值 //////////////////////////////////////////////////////////////////////////////////////////////////// // public CPropertyValue(float Value) { this.m_eValueType = eValueType.VALUE; this.m_Value = Value; this.m_FinalValue = Value; this.m_MinData = 0; this.m_MaxData = 0; this.m_lpNext = null; this.m_lpPrev = null; }
public void Init(Sprite icon, int id, string name, string contents, string purchaseText, int level, double value, double cost, double time, StaticValues.TwoIntPramCallback callback, eValueType valueType = eValueType.Expo) { mIcon.sprite = icon; mID = id; mNameText.text = name; mPurchaseButton.onClick.AddListener(() => { callback(mID, 1); }); Renew(contents, purchaseText, level, value, cost, time, valueType); }
public int GetAttrBase(eValueType type, eSkillAttrIndex idx) { if (idx >= eSkillAttrIndex.Power && idx <= eSkillAttrIndex.Dex) { return(mAttrs[type][(int)idx].Base); } if (idx >= eSkillAttrIndex.HP && idx < eSkillAttrIndex.MAX) { return(mSecondAttrs[type][(int)idx].Base); } return(0); }
public void AddAttrBasePer(eValueType type, eSkillAttrIndex idx, float value) { OnAttrChanged(idx); if (idx >= eSkillAttrIndex.Power && idx <= eSkillAttrIndex.Dex) { FinalRoleValue.AddAttrBasePer(type, idx, value); return; } if (idx >= eSkillAttrIndex.HP && idx < eSkillAttrIndex.MAX) { FinalRoleValue.AddSecondAttrBasePer(type, idx, value); } }
public void CalcChangeType(eValueType eType) { //switch (eType) //{ // case eValueType.Equip: // CalcEquipPoint(); // break; // case eValueType.Gem: // CalcGemPoint(); // break; // case eValueType.Buff: // CalcBuffPoint(); // break; // case eValueType.Skill: // CalcSkillPoint(); // break; // default: // break; //} //_CaclFinalPoint(); }
/// <summary> /// 寻找比率 /// </summary> /// <param name="value"></param> /// <returns></returns> public CPropertyValue Find(float value, eValueType type) { //向上遍历 CPropertyValue lpPrev = this; while (lpPrev != null) { if (Math.Abs(lpPrev.m_Value - value) < 0.00001f && (int)lpPrev.m_eValueType == (int)type) { return(lpPrev); } if (null == lpPrev.m_lpPrev) { break; } lpPrev = lpPrev.m_lpPrev; } //向下遍历 CPropertyValue lpnext = this; while (lpnext != null) { if (Math.Abs(lpnext.m_Value - value) < 0.000001f && (int)lpnext.m_eValueType == (int)type) { return(lpnext); } if (null == lpnext.m_lpNext) { break; } lpnext = lpnext.m_lpNext; } return(null); }
public cValueTypeObject(string sValueTypeKey, string sName, string sType, string sRange, Dictionary <string, string> SelectableValues, string sComment) { this.sValueTypeKey = sValueTypeKey; this.sRange = sRange; this.sComment = sComment; this.SelectableValues = SelectableValues; this.sName = sName; //color foreach (eValueType valueType in Enum.GetValues(typeof(eValueType))) { if (sType.Equals(valueType.ToString().Substring(1), StringComparison.OrdinalIgnoreCase)) { ValueType = valueType; break; } } // // sValueRange: // // [1-65025] // [text] // YYYY // -[username] // "-False\n- True" // [time stamp] // [binary] // [number] // [speed] // [0-100] // "-0\n-1\n-2" // // sComment: // // "False: Fixed time control inactive\nTrue: Fixed time control active" // "0: disabled\n1: dark mode\n2: yellow flash" // Number of emergency stage // Time stamp of the checksum. Format according to W3C XML dateTime with a resolution of 3 decimal places. All time stamps in UTC. E.g. 2009-10-02T14:34:34.341Z if (ValueType == eValueType._unknown) { return; } try { switch (ValueType) { case eValueType._string: if (SelectableValues == null) { SelectableValues = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase); } else { } foreach (string sValue in sRange.Trim(new char[] { '\"', '[', ']', ' ' }).Split('\n')) { if (sValue.StartsWith("-")) { string sKey = sValue.Substring(1); if (SelectableValues.ContainsKey(sKey) == false) { SelectableValues.Add(sKey, ""); } } } break; case eValueType._raw: case eValueType._scale: case eValueType._unit: case eValueType._base64: { // "-on\n-off" // Accept just about anything... } break; case eValueType._boolean: { } break; case eValueType._integer: case eValueType._long: case eValueType._real: case eValueType._ordinal: if (sRange.StartsWith("[") && sRange.EndsWith("]") && sRange.Contains("-")) { string[] sFromTo = sRange.Trim(new char[] { '\"', '[', ']', ' ' }).Split('-'); if (sFromTo[1].Contains(",")) { sFromTo[1] = cHelper.Item(sFromTo[1], 0, ','); } switch (ValueType) { case eValueType._integer: if (Int16.TryParse(sFromTo[0], out iMinValue) == false) { iMinValue = Int16.MinValue; } if (Int16.TryParse(sFromTo[1], out iMaxValue) == false) { iMaxValue = Int16.MaxValue; } break; case eValueType._long: case eValueType._ordinal: if (Int32.TryParse(sFromTo[0], out lMinValue) == false) { lMinValue = Int32.MinValue; } if (Int32.TryParse(sFromTo[1], out lMaxValue) == false) { lMaxValue = Int32.MaxValue; } break; case eValueType._real: if (double.TryParse(sFromTo[0], out dMinValue) == false) { dMinValue = double.MinValue; } if (double.TryParse(sFromTo[1], out dMaxValue) == false) { dMaxValue = double.MaxValue; } break; } } break; } } catch { RSMPGS.SysLog.SysLog(cSysLogAndDebug.Severity.Warning, "Failed to parse value and range: {0}", sValueTypeKey.Replace("\t", "/")); } /* * string sSelectableValues = ""; * if (SelectableValues != null) * { * foreach (string SelectableValue in SelectableValues.Keys) * { * sSelectableValues += SelectableValue + "."; * } * } * * Debug.WriteLine("cValueTypeObject: " + sValueTypeKey + "\t" + ValueType.ToString() + "\t" + "Range: " + sRange + "\t" + "Values: " + sSelectableValues + "\t" + "sComment: " + sComment.Replace("\n", "\\n")); */ }
public void AddSecondAttrBasePer(eValueType type, eSkillAttrIndex idx, float value) { mSecondAttrs[type][(int)idx].AddBasePer(value); }
public void SetAttrBasePer(eValueType type, eSkillAttrIndex idx, float value) { mAttrs[type][(int)idx].SetBasePer(value); }
public void AddAttrBase(eValueType type, eSkillAttrIndex idx, int value) { mAttrs[type][(int)idx].AddBase(value); }
public void SetSecondAttrBase(eValueType type, eSkillAttrIndex idx, int value) { mSecondAttrs[type][(int)idx].Base = value; }