// 在此初始化参数 protected override void OnCreate() { obj = Utility.ToObject(parameters["object"]); stat = (AttribType)Utility.ToEnumInt(parameters["stat"]); comp = Utility.ToCompare(parameters["compare"]); amt = Utility.ToSingle(missionVars, parameters["amount"]); }
public override void Read(XmlElement os) { base.Read(os); this.Compare = os.GetEnum <ECompare>("Compare"); this.ItemID = os.GetInt32("ItemID"); this.ItemNum = os.GetInt32("ItemNum"); }
/// <summary> /// Sets a simple filter comparing two columns against each other. /// </summary> /// <param name="column1">Column name from incoming data</param> /// <param name="operator1">Comparison Operator</param> /// <param name="column2">Static value to compare to</param> /// <param name="dataType">Data type of the column</param> public Filter(TableColumn column1, ECompare operator1, TableColumn column2, ETypeCode dataType) { Column1 = column1; Operator = operator1; Column2 = column2; CompareDataType = dataType; }
public static bool CompareVar(Var lhs, Var rhs, ECompare comp) { if (lhs.isInteger && rhs.isInteger) { return(Compare((int)lhs, (int)rhs, comp)); } if (lhs.isNumber && rhs.isNumber) { return(Compare((double)lhs, (double)rhs, comp)); } if (lhs.isString && rhs.isString) { return(Compare((string)lhs, (string)rhs, comp)); } if (lhs.isBool && rhs.isBool) { return(Compare((bool)lhs, (bool)rhs, comp)); } if (lhs.isBool && rhs.isInteger) { return(Compare((bool)lhs, ((int)rhs != 0), comp)); } if (lhs.isInteger && rhs.isBool) { return(Compare(((int)lhs != 0), (bool)rhs, comp)); } return(lhs); }
public Filter(string columnName1, ECompare operator1, string columnName2, ETypeCode dataType) { Column1 = new TableColumn(columnName1); Operator = operator1; Column2 = new TableColumn(columnName2); CompareDataType = dataType; }
OBJECT item; // ITEM // 在此初始化参数 protected override void OnCreate() { player = Utility.ToObject(parameters["player"]); comp = Utility.ToCompare(parameters["compare"]); count = Utility.ToInt(missionVars, parameters["count"]); item = Utility.ToObject(parameters["item"]); }
// 在此初始化参数 protected override void OnCreate() { obj1 = Utility.ToObject(parameters["object1"]); obj2 = Utility.ToObject(parameters["object2"]); comp = Utility.ToCompare(parameters["compare"]); dist = Utility.ToSingle(missionVars, parameters["distance"]); }
// 在此初始化参数 protected override void OnCreate() { axis = (EAxis)Utility.ToEnumInt(parameters["axis"]); obj1 = Utility.ToObject(parameters["object1"]); obj2 = Utility.ToObject(parameters["object2"]); comp = Utility.ToCompare(parameters["compare"]); amt = Utility.ToSingle(missionVars, parameters["amount"]); }
public static void SortMin(string[] arr, ECompare compare) //compare { for (int i = 0; i < arr.Length - 1; i++) { int im = IndexMin(arr, i, compare); string x = arr[i]; arr[i] = arr[im]; arr[im] = x; } }
public bool CompareStopwatch(int id, ECompare comp, double amount) { double sec = 0; if (stopwatches.ContainsKey(id)) { sec = stopwatches[id].timer.Second; } return(Utility.Compare(sec, amount, comp)); }
static int IndexMin(string[] arr, int i, ECompare compare) //Метод, находящий меньшую строку //compare { int im = i; for (int j = i + 1; j < arr.Length; j++) { if (!compare(arr[j], arr[im])) //compare { im = j; } } return(im); }
// 在此初始化参数 protected override void OnCreate() { goalId = Utility.ToInt(missionVars, parameters["id"]); text = Utility.ToText(missionVars, parameters["text"]); missionId = Utility.ToEnumInt(parameters["mission"]); item = Utility.ToObject(parameters["item"]); comp = Utility.ToCompare(parameters["compare"]); amt = Utility.ToInt(missionVars, parameters["amount"]); if (missionId == 0) { missionId = mission.dataId; } }
// utility - getter private void Setter(Filter f, ECompare c, string value) { _filterCompare[(int)f] = c; _filterValue[(int)f] = ""; if (c != ECompare.ANY) { if (string.IsNullOrWhiteSpace(value)) { _filterCompare[(int)f] = ECompare.ANY; } else { _filterValue[(int)f] = value; } } }
public static bool Compare(float lhs, float rhs, ECompare comp) { switch (comp) { case ECompare.Greater: return(lhs > rhs); case ECompare.GreaterEqual: return(lhs >= rhs); case ECompare.Equal: return(lhs == rhs); case ECompare.NotEqual: return(lhs != rhs); case ECompare.LessEqual: return(lhs <= rhs); case ECompare.Less: return(lhs < rhs); default: return(false); } }
/// <summary> /// Sets a simple filter comparing a column against a static value. /// </summary> /// <param name="column1">Column name from incoming data</param> /// <param name="operator1">Comparison Operator</param> /// <param name="value2">Static value to compare to</param> public Filter(TableColumn column1, ECompare operator1, object value2) { Column1 = column1; Operator = operator1; Value2 = value2; if (Value2 == null) { CompareDataType = ETypeCode.String; } else if (Value2.GetType().IsArray) { CompareDataType = GetTypeCode(Value2.GetType().GetElementType()); } else { CompareDataType = GetTypeCode(Value2.GetType()); } }
public static bool Compare(string lhs, string rhs, ECompare comp) { switch (comp) { case ECompare.Greater: return(string.Compare(lhs, rhs) > 0); case ECompare.GreaterEqual: return(string.Compare(lhs, rhs) >= 0); case ECompare.Equal: return(string.Compare(lhs, rhs) == 0); case ECompare.NotEqual: return(string.Compare(lhs, rhs) != 0); case ECompare.LessEqual: return(string.Compare(lhs, rhs) <= 0); case ECompare.Less: return(string.Compare(lhs, rhs) < 0); default: return(false); } }
public Filter(string columnName1, ECompare operator1, object value2) { Operator = operator1; Value2 = value2; if (Value2 == null) { CompareDataType = ETypeCode.String; } else if (Value2.GetType().IsArray) { CompareDataType = GetTypeCode(Value2.GetType().GetElementType()); } else { CompareDataType = GetTypeCode(Value2.GetType()); } Column1 = new TableColumn(columnName1, CompareDataType); }
public void SetKillGoal(int id, string text, int missionId, OBJECT monster, ECompare compare, int amount) { if (!m_Scenario.IsMissionActive(missionId)) { return; } if (!m_Goals.ContainsKey(missionId)) { m_Goals[missionId] = new SortedList <int, MissionGoal>(4); } var goal_list = m_Goals[missionId]; if (!goal_list.ContainsKey(id)) { goal_list[id] = new MissionGoal_Kill(); goal_list[id].onAchieve = onGoalAchieve; goal_list[id].Init(); } if (!(goal_list[id] is MissionGoal_Kill)) { goal_list[id].Free(); goal_list[id] = new MissionGoal_Kill(); goal_list[id].onAchieve = onGoalAchieve; goal_list[id].Init(); } var goal = goal_list[id] as MissionGoal_Kill; goal.id = id; goal.text = text; goal.missionId = missionId; goal.monster = monster; goal.compare = compare; goal.target = amount; if (onSetMissionGoal != null) { onSetMissionGoal(id, missionId); } }
public static bool Compare(bool lhs, bool rhs, ECompare comp) { int l = lhs ? 1 : 0; int r = rhs ? 1 : 0; switch (comp) { case ECompare.Greater: return(l > r); case ECompare.GreaterEqual: return(l >= r); case ECompare.Equal: return(l == r); case ECompare.NotEqual: return(l != r); case ECompare.LessEqual: return(l <= r); case ECompare.Less: return(l < r); default: return(false); } }
public static bool Compare_A_B(int a, int b, ECompare c) { switch (c) { case ECompare.Equal: { return(a == b); } case ECompare.NotEqual: { return(a != b); } case ECompare.Greater: { return(a > b); } case ECompare.Less: { return(a < b); } case ECompare.Greater_Equal: { return(a >= b); } case ECompare.Less_Equal: { return(a <= b); } } return(false); }
public override void Read(XmlElement os) { base.Read(os); this.Compare = os.GetEnum <ECompare>("Compare"); this.HPValue = os.GetInt32("HPValue"); }
// 在此初始化参数 protected override void OnCreate() { lhs = Utility.ToVar(missionVars, parameters["lhs"]); comp = Utility.ToCompare(parameters["compare"]); rhs = Utility.ToVar(missionVars, parameters["rhs"]); }
// setter public void Basis(ECompare c, string value) { Setter(Filter.BASIS, c, value); }
// setter public void DeltaTitle(ECompare c, string value) { Setter(Filter.DELTATITLE, c, value); }
// setter public void BlockTitle(ECompare c, string value) { Setter(Filter.BLOCKTITLE, c, value); }
// setter public void RevAltId(ECompare c, string value = "") { Setter(Filter.REVALTID, c, value); }
// setter public void RevId(ECompare c, string value = "") { Setter(REVID, c, value); }
// 在此初始化参数 protected override void OnCreate() { id = Utility.ToInt(missionVars, parameters["id"]); comp = Utility.ToCompare(parameters["compare"]); amt = Utility.ToDouble(missionVars, parameters["amount"]); }
public override void Read(XmlElement os) { base.Read(os); this.Compare = os.GetEnum <ECompare>("Compare"); this.HPPercent = os.GetFloat("HPValue"); }
public override void Read(XmlElement os) { base.Read(os); this.Compare = os.GetEnum <ECompare>("Compare"); this.VipLevel = os.GetInt32("VipLevel"); }