Exemplo n.º 1
0
 // 在此初始化参数
 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"]);
 }
Exemplo n.º 2
0
 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");
 }
Exemplo n.º 3
0
 /// <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;
 }
Exemplo n.º 4
0
 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);
 }
Exemplo n.º 5
0
 public Filter(string columnName1, ECompare operator1, string columnName2, ETypeCode dataType)
 {
     Column1         = new TableColumn(columnName1);
     Operator        = operator1;
     Column2         = new TableColumn(columnName2);
     CompareDataType = dataType;
 }
Exemplo n.º 6
0
        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"]);
 }
Exemplo n.º 8
0
 // 在此初始化参数
 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"]);
 }
Exemplo n.º 9
0
 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;
     }
 }
Exemplo n.º 10
0
        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));
        }
Exemplo n.º 11
0
        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);
        }
Exemplo n.º 12
0
        // 在此初始化参数
        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;
            }
        }
Exemplo n.º 13
0
        // 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;
                }
            }
        }
Exemplo n.º 14
0
        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);
            }
        }
Exemplo n.º 15
0
        /// <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());
            }
        }
Exemplo n.º 16
0
        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);
            }
        }
Exemplo n.º 17
0
        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);
        }
Exemplo n.º 18
0
        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);
            }
        }
Exemplo n.º 19
0
        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);
            }
        }
Exemplo n.º 20
0
        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);
        }
Exemplo n.º 21
0
 public override void Read(XmlElement os)
 {
     base.Read(os);
     this.Compare = os.GetEnum <ECompare>("Compare");
     this.HPValue = os.GetInt32("HPValue");
 }
Exemplo n.º 22
0
 // 在此初始化参数
 protected override void OnCreate()
 {
     lhs  = Utility.ToVar(missionVars, parameters["lhs"]);
     comp = Utility.ToCompare(parameters["compare"]);
     rhs  = Utility.ToVar(missionVars, parameters["rhs"]);
 }
Exemplo n.º 23
0
 // setter
 public void Basis(ECompare c, string value)
 {
     Setter(Filter.BASIS, c, value);
 }
Exemplo n.º 24
0
 // setter
 public void DeltaTitle(ECompare c, string value)
 {
     Setter(Filter.DELTATITLE, c, value);
 }
Exemplo n.º 25
0
 // setter
 public void BlockTitle(ECompare c, string value)
 {
     Setter(Filter.BLOCKTITLE, c, value);
 }
Exemplo n.º 26
0
 // setter
 public void RevAltId(ECompare c, string value = "")
 {
     Setter(Filter.REVALTID, c, value);
 }
Exemplo n.º 27
0
 // setter
 public void RevId(ECompare c, string value = "")
 {
     Setter(REVID, c, value);
 }
Exemplo n.º 28
0
 // 在此初始化参数
 protected override void OnCreate()
 {
     id   = Utility.ToInt(missionVars, parameters["id"]);
     comp = Utility.ToCompare(parameters["compare"]);
     amt  = Utility.ToDouble(missionVars, parameters["amount"]);
 }
Exemplo n.º 29
0
 public override void Read(XmlElement os)
 {
     base.Read(os);
     this.Compare   = os.GetEnum <ECompare>("Compare");
     this.HPPercent = os.GetFloat("HPValue");
 }
Exemplo n.º 30
0
 public override void Read(XmlElement os)
 {
     base.Read(os);
     this.Compare  = os.GetEnum <ECompare>("Compare");
     this.VipLevel = os.GetInt32("VipLevel");
 }