public void Rename()
        {
            string id = null;

            try
            {
                string dn = $"{Guid.NewGuid()}@{UnitTestControl.TestParameters.Domain}";
                User   e  = new User
                {
                    PrimaryEmail = dn,
                    Password     = Guid.NewGuid().ToString(),
                    Name         =
                    {
                        GivenName  = "test",
                        FamilyName = "test"
                    }
                };

                e  = UnitTestControl.TestParameters.UsersService.Add(e);
                id = e.Id;
                System.Threading.Thread.Sleep(2000);

                CSEntryChange cs = CSEntryChange.Create();
                cs.ObjectModificationType = ObjectModificationType.Update;
                cs.DN         = dn;
                cs.ObjectType = SchemaConstants.User;

                string newDN = $"{Guid.NewGuid()}@{UnitTestControl.TestParameters.Domain}";

                cs.AttributeChanges.Add(AttributeChange.CreateAttributeUpdate("DN", new List <ValueChange>()
                {
                    ValueChange.CreateValueAdd(newDN), ValueChange.CreateValueDelete(dn)
                }));

                cs.AnchorAttributes.Add(AnchorAttribute.Create("id", id));
                CSEntryChangeResult result =
                    ExportProcessor.PutCSEntryChange(cs, UnitTestControl.Schema.GetSchema().Types[SchemaConstants.User], UnitTestControl.TestParameters);

                if (result.ErrorCode != MAExportError.Success)
                {
                    Assert.Fail(result.ErrorName);
                }

                System.Threading.Thread.Sleep(2000);
                e = UnitTestControl.TestParameters.UsersService.Get(id);
                Assert.AreEqual(newDN, e.PrimaryEmail);
            }
            finally
            {
                if (id != null)
                {
                    UnitTestControl.TestParameters.UsersService.Delete(id);
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Merges two lists of ValueChange objects, canceling out any matching Add/Delete pairs and duplicate values
        /// </summary>
        /// <param name="attribute">The attribute that the ValueChanges represent</param>
        /// <param name="sourceList">The original list of ValueChanges</param>
        /// <param name="newValues">The new list of ValueChanges</param>
        /// <returns>A new list containing the merged values from both lists</returns>
        public static IList <ValueChange> MergeValueChangeLists(AcmaSchemaAttribute attribute, IList <ValueChange> sourceList, IList <ValueChange> newValues)
        {
            IList <ValueChange> newList = new List <ValueChange>(sourceList);

            if (newValues.Count == 0)
            {
                return(newList);
            }

            ValueChangeComparer valueComparer = new ValueChangeComparer(attribute, false);

            IList <ValueChange> nonDuplicatedNewList = RemoveDuplicateValueChanges(attribute, newValues);

            foreach (var newChange in nonDuplicatedNewList)
            {
                ValueChange changeInSource = sourceList.FirstOrDefault(t => valueComparer.Equals(newChange, t));

                if (changeInSource == null)
                {
                    newList.Add(newChange);
                }
                else
                {
                    if (changeInSource.ModificationType == ValueModificationType.Add)
                    {
                        if (newChange.ModificationType == ValueModificationType.Delete)
                        {
                            Logger.WriteLine("Canceled attribute add due to subsequent delete: {0} - {1}", LogLevel.Debug, attribute.Name, changeInSource.Value.ToSmartStringOrNull());
                            newList.Remove(changeInSource);
                        }
                        else if (newChange.ModificationType == ValueModificationType.Add)
                        {
                            Logger.WriteLine("Duplicate add detected: {0} - {1}", LogLevel.Debug, attribute.Name, changeInSource.Value.ToSmartStringOrNull());
                            continue;
                        }
                    }
                    else if (changeInSource.ModificationType == ValueModificationType.Delete)
                    {
                        if (newChange.ModificationType == ValueModificationType.Add)
                        {
                            Logger.WriteLine("Canceled attribute delete due to subsequent add: {0} - {1}", LogLevel.Debug, attribute.Name, changeInSource.Value.ToSmartStringOrNull());
                            newList.Remove(changeInSource);
                            newList.Add(newChange);
                        }
                        else if (newChange.ModificationType == ValueModificationType.Delete)
                        {
                            Logger.WriteLine("Duplicate delete detected: {0} - {1}", LogLevel.Debug, attribute.Name, changeInSource.Value.ToSmartStringOrNull());
                            continue;
                        }
                    }
                }
            }

            return(newList);
        }
예제 #3
0
 /// <summary>
 /// Create a ValueChange for the specified value based on the modification type specified by this object
 /// </summary>
 /// <param name="newValue">The value to create the value change for</param>
 /// <param name="modificationType">The type of modification to perform</param>
 /// <returns>A new ValueChange object</returns>
 protected ValueChange CreateValueChange(object newValue, ValueModificationType modificationType)
 {
     if (modificationType == ValueModificationType.Delete)
     {
         return(ValueChange.CreateValueDelete(newValue));
     }
     else
     {
         return(ValueChange.CreateValueAdd(newValue));
     }
 }
예제 #4
0
 private void valueChangeHelper(int index, MouseButtonEventArgs e)
 {
     if (curValues != null && index >= 0 && index < curValues.Length)
     {
         ValueChange.Invoke(canvases[index], new ValueChangeArgs()
         {
             Index = index,
             Value = (curValues[index] > 0.5 ? 0.0 : 1.0)
         });
     }
 }
예제 #5
0
 //Make sure to set the gameObject to inactive before calling this
 public bool Setup(ObjectPool pool, ValueChange <GameObject> del)
 {
     if (!isSetup)
     {
         Add        = del;
         objectPool = pool;
         isSetup    = true;
         return(true);
     }
     return(false);
 }
예제 #6
0
 public static string GetRowKeyAsString(this RowInfo rowInfo)
 {
     FieldInfo[] finfos = rowInfo.dbSetInfo.GetPKFieldInfos();
     string[]    vals   = new string[finfos.Length];
     for (int i = 0; i < finfos.Length; ++i)
     {
         ValueChange fv = rowInfo.GetValue(finfos[i].fieldName);
         vals[i] = fv.val;
     }
     return(string.Join(";", vals));
 }
        /// <summary>
        /// Constructs a target attribute value based on the rules in the constructor
        /// </summary>
        /// <param name="hologram">The object to construct the value for</param>
        internal override void Execute(MAObjectHologram hologram)
        {
            long newValue = this.Sequence.GetNextValue();
            List <ValueChange> valueChanges = new List <ValueChange>()
            {
                ValueChange.CreateValueAdd(newValue)
            };

            this.ApplyValueChanges(hologram, valueChanges, AcmaAttributeModificationType.Replace);
            this.RaiseCompletedEvent();
        }
예제 #8
0
    public bool RemoveValueChange <T>(Action <T> setter, T newValue)
    {
        ValueChange <T> newChange = new ValueChange <T>(setter, newValue);

        if (allChanges.Contains(newChange) || !newValue.GetType().BaseType.IsEnum)
        {
            return(false);
        }
        allChanges.Add(newChange);
        return(true);
    }
        /// <summary>
        /// Converts an enumeration of values to a list of ValueChanges with the modification type set to 'delete'
        /// </summary>
        /// <typeparam name="T">The type of the data in the list</typeparam>
        /// <param name="list">The list of values to convert to ValueChanges</param>
        /// <returns>A list of ValueChange objects with their modification types set to 'delete'</returns>
        public static IList <ValueChange> ToValueChangeDelete <T>(this IEnumerable <T> list)
        {
            List <ValueChange> changes = new List <ValueChange>();

            foreach (T value in list)
            {
                changes.Add(ValueChange.CreateValueDelete(value));
            }

            return(changes);
        }
예제 #10
0
        public override void Create()
        {
            GTile   = MainView.GetChild("Map").asCom.GetChild("Tile").asCom;
            GLine   = MainView.GetChild("Map").asCom.GetChild("Line").asCom;
            GBattle = MainView.GetChild("Battle").asCom;

            GTextInput pName = MainView.GetChild("PlayerName").asTextInput;

            pName.text = PlayerPrefs.GetString("PlayerName", "");
            pName.onFocusOut.Add(() => PlayerPrefs.SetString("PlayerName", pName.text));

            MainView.GetChild("Hp").text   = $"{THClimbTower.Game.Instance.player.NowHp}/{THClimbTower.Game.Instance.player.MaxHp}";
            MainView.GetChild("Gold").text = THClimbTower.Game.Instance.player.Gold.ToString();

            //监听金币变化
            THClimbTower.Game.Instance.EventSystem.AddAction(THClimbTower.EventType.GoldChange, (t, vs) =>
            {
                ValueChange vc = vs[0] as ValueChange;
                MainView.GetChild("Gold").text = vc.AfterValue.ToString();
            });
            //监听血量变化
            THClimbTower.Game.Instance.EventSystem.AddAction(THClimbTower.EventType.HpChange, (t, vs) =>
            {
                Player p = vs[0] as Player;
                if (p == null)
                {
                    return;
                }
                ValueChange vc = vs[1] as ValueChange;
                MainView.GetChild("Hp").text = $"{vc.AfterValue}/{THClimbTower.Game.Instance.player.MaxHp}";
            });
            //监听战斗开始
            THClimbTower.Game.Instance.EventSystem.AddAction(THClimbTower.EventType.BattleStart, (t, vs) =>
            {
                MainView.GetController("c1").selectedIndex = 1;
                Battle battle      = THClimbTower.Game.Instance.NowBattle;
                GComponent gPlayer = UIPackage.CreateObject("Map", "BattleCharactor").asCom;
                GBattle.AddChild(gPlayer);
                new UIModule.UICharactor(gPlayer, THClimbTower.Game.Instance.player);
                foreach (var a in battle.Enemys)
                {
                    GComponent gEnemy = UIPackage.CreateObject("Map", "BattleCharactor").asCom;
                    GBattle.AddChild(gEnemy);
                    UIModule.UICharactor uICharactor = new UIModule.UICharactor(gEnemy, a);
                    gEnemy.xy = new Vector2(a.X, a.Y);
                }
            }, 100);

            THClimbTower.Game.Instance.EventSystem.AddAction(THClimbTower.EventType.FreshMap, FreshMap);
            THClimbTower.Game.Instance.EventSystem.AddAction(THClimbTower.EventType.ReBuildMap, CreatMap);

            //由于Create的时候地图已经生成了,还没有监听上,所以要手动创建一次
            CreatMap(THClimbTower.EventType.ReBuildMap, THClimbTower.Game.Instance.NowMap);
        }
예제 #11
0
        public void Stop()
        {
            if (_timer != null)
            {
                _timer.Stop();
                _timer = null;

                _measures.Clear();
                _lastValue = 0;
                ValueChange?.Invoke(_lastValue);
            }
        }
        /// <summary>
        /// Evaluates the rule against a single-valued attribute
        /// </summary>
        /// <param name="csentry">The source object</param>
        /// <returns>A value indicating whether the rule conditions were met</returns>
        private bool EvaluateSingleValuedAttribute(CSEntryChange csentry)
        {
            object value = null;

            if (csentry.AttributeChanges.Any(t => t.Name == this.AttributeName))
            {
                ValueChange valueChange = csentry.AttributeChanges[this.AttributeName].ValueChanges.FirstOrDefault(t => t.ModificationType == ValueModificationType.Add);
                value = valueChange == null ? null : valueChange.Value;
            }

            return(this.EvaluateAttributeValue(value));
        }
예제 #13
0
        public ValueChangeBase GetChangeData()
        {
            ValueChange <T> changeData = new ValueChange <T>();

            changeData.name = name;

            changeData.data = data;

            isChange = false;

            return(changeData);
        }
예제 #14
0
        public void ContactRename()
        {
            string id = null;

            try
            {
                string       dn = Guid.NewGuid().ToString();
                ContactEntry e  = new ContactEntry();

                e.Emails.Add(new EMail()
                {
                    Address = "*****@*****.**", Label = "work"
                });

                e.ExtendedProperties.Add(new ExtendedProperty(dn, ApiInterfaceContact.DNAttributeName));

                e  = UnitTestControl.TestParameters.ContactsService.Add(e, UnitTestControl.TestParameters.Domain);
                id = e.SelfUri.Content;

                CSEntryChange cs = CSEntryChange.Create();
                cs.ObjectModificationType = ObjectModificationType.Update;
                cs.DN         = dn;
                cs.ObjectType = SchemaConstants.Contact;

                string newDN = Guid.NewGuid().ToString();

                cs.AttributeChanges.Add(AttributeChange.CreateAttributeUpdate("DN", new List <ValueChange>()
                {
                    ValueChange.CreateValueAdd(newDN), ValueChange.CreateValueDelete(dn)
                }));

                cs.AnchorAttributes.Add(AnchorAttribute.Create("id", id));
                CSEntryChangeResult result = ExportProcessor.PutCSEntryChange(cs, UnitTestControl.Schema.GetSchema().Types[SchemaConstants.Contact], UnitTestControl.TestParameters);

                if (result.ErrorCode != MAExportError.Success)
                {
                    Assert.Fail(result.ErrorName);
                }

                System.Threading.Thread.Sleep(5000);
                e = UnitTestControl.TestParameters.ContactsService.GetContact(id);
                Assert.AreEqual(newDN, e.ExtendedProperties.Single(t => t.Name == ApiInterfaceContact.DNAttributeName).Value);
                var x = CSEntryChangeQueue.Take();
            }
            finally
            {
                if (id != null)
                {
                    UnitTestControl.TestParameters.ContactsService.Delete(id);
                }
            }
        }
예제 #15
0
        public static object[] GetPKValues(this RowInfo rowInfo, IDataHelper dataHelper)
        {
            Type entityType = rowInfo.dbSetInfo.EntityType;

            FieldInfo[] finfos = rowInfo.dbSetInfo.GetPKFieldInfos();
            object[]    result = new object[finfos.Length];
            for (int i = 0; i < finfos.Length; ++i)
            {
                ValueChange fv = rowInfo.GetValue(finfos[i].fieldName);
                result[i] = fv.GetTypedValue(entityType, rowInfo.dbSetInfo, dataHelper);
            }
            return(result);
        }
예제 #16
0
    ////////////////////
    // Public Methods //
    ////////////////////

    public bool AddValueChange <T>(Action <T> setter, T newValue)
    {
        ValueChange <T> newChange = new ValueChange <T>(setter, newValue);

        if (allChanges.Contains(newChange)) // || !newValue.GetType().BaseType.IsEnum
        {
            Global.Methods.PrintError("This value change was added previously: " + newChange);
            return(false);
        }
        allChanges.Add(newChange);
        Global.Methods.PrintInfo("New value change added: " + newChange);
        return(true);
    }
예제 #17
0
        private void OnKeyPress(KeyboardEventArgs args)
        {
            if (args == null)
            {
                return;
            }
            if (ValueChange.HasDelegate)
            {
                ValueChange.InvokeAsync(args.Code);
            }

            return;
        }
예제 #18
0
 /// <summary>
 /// Removes a reference to the source object on the specified target object
 /// </summary>
 /// <param name="sourceObject">The object to remove the reference to</param>
 /// <param name="targetObject">The object to remove the reference from</param>
 private void RemoveReference(MAObjectHologram sourceObject, MAObjectHologram targetObject)
 {
     if (this.BackLinkAttribute.IsMultivalued)
     {
         targetObject.UpdateAttributeValue(this.BackLinkAttribute, new List <ValueChange>()
         {
             ValueChange.CreateValueDelete(sourceObject.ObjectID)
         });
     }
     else
     {
         targetObject.DeleteAttribute(this.BackLinkAttribute);
     }
 }
    private void Awake()
    {
        attack    = GameObject.FindWithTag(Tags.player).GetComponent <PlayerAttack>();
        name_text = transform.Find("NameImage/Text").GetComponent <Text>();
        hpStatus  = transform.Find("HPImage").GetComponent <ValueChange>();
        mpStatus  = transform.Find("MPImage").GetComponent <ValueChange>();
        expStatus = transform.Find("EXPImage").GetComponent <ValueChange>();

        numHP_text  = transform.Find("HPImage/NumText").GetComponent <Text>();
        numMP_text  = transform.Find("MPImage/NumText").GetComponent <Text>();
        numEXP_text = transform.Find("EXPImage/NumText").GetComponent <Text>();

        death_image = transform.Find("FaceMask_RawImage/DeathImage").GetComponent <Image>();
    }
        private IList <ValueChange> DeleteFromRole(AttributeChange change, IList <AclRule> existingRules, string role, string calendarId)
        {
            List <ValueChange> valueChanges = new List <ValueChange>();

            IList <string> deletes;

            if (change.ModificationType == AttributeModificationType.Delete || change.ModificationType == AttributeModificationType.Replace)
            {
                deletes = existingRules.Where(t => t.Role == role).Select(t => t.Scope.Value).ToList();
            }
            else
            {
                deletes = change.GetValueDeletes <string>();
            }

            foreach (string valueToDelete in deletes)
            {
                AclRule matchedRule = existingRules.FirstOrDefault(t => t.Role == role && valueToDelete.Equals(t.Scope.Value, StringComparison.CurrentCultureIgnoreCase));

                if (matchedRule == null)
                {
                    Logger.WriteLine($"{valueToDelete} does not have role {role} on calendar {calendarId}. The request to delete the value will be ignored");
                    valueChanges.Add(ValueChange.CreateValueDelete(valueToDelete));

                    continue;
                }

                if (matchedRule.Role == "owner" && calendarId.Equals(matchedRule.Scope.Value, StringComparison.CurrentCultureIgnoreCase))
                {
                    Debug.WriteLine($"Ignoring default ACL for {valueToDelete} to role {role} on calendar {calendarId}");
                    continue;
                }

                try
                {
                    this.config.ResourcesService.DeleteCalendarAclRule(this.config.CustomerID, calendarId, matchedRule.Id);
                    Logger.WriteLine($"Removed {valueToDelete} from role {role} on calendar {calendarId}");
                }
                catch
                {
                    Logger.WriteLine($"Failed to remove {valueToDelete} to role {role} on calendar {calendarId}");
                    throw;
                }

                valueChanges.Add(ValueChange.CreateValueDelete(valueToDelete));
            }

            return(valueChanges);
        }
예제 #21
0
        private static List <ValueChange> GetValueChanges(XElement element, ExtendedAttributeType attributeType)
        {
            List <ValueChange> valueChanges = new List <ValueChange>();

            foreach (var child in element.Elements().Where(t => t.Name.LocalName == "value-change"))
            {
                ValueChange change = CSEntryChangeXmlImport.GetValueChange(child, attributeType);
                if (change != null)
                {
                    valueChanges.Add(change);
                }
            }

            return(valueChanges);
        }
        /// <summary>
        /// Reads the <![CDATA[<value-changes>]]> node of the XML representation of the <see cref="Microsoft.MetadirectoryServices.CSEntryChange">CSEntryChange</see>
        /// </summary>
        /// <param name="element">An <c ref="System.Linq.Xml.XElement">XElement</c> containing an <![CDATA[<value-changes>]]> element</param>
        /// <param name="attributeType">The type of attribute to read</param>
        /// <returns>A list of ValueChanges</returns>
        private static List <ValueChange> XmlReadValueChangesNode(XElement element, AttributeType attributeType)
        {
            List <ValueChange> valueChanges = new List <ValueChange>();

            foreach (XElement child in element.Elements().Where(t => t.Name.LocalName == "value-change"))
            {
                ValueChange change = CSEntryChangeDeserializer.XmlReadValueChangeNode(child, attributeType);
                if (change != null)
                {
                    valueChanges.Add(change);
                }
            }

            return(valueChanges);
        }
예제 #23
0
        private void 确定_Click(object sender, RoutedEventArgs e)
        {
            flyout.Hide();

            if (Number > Max)
            {
                Number = Max;
            }
            if (Number < Min)
            {
                Number = Min;
            }
            Value = Number;
            ValueChange?.Invoke(this, Number); //用户控件:Value改变
        }
예제 #24
0
        public static IEnumerable <Change> FindChanges(ValueChange <SessionToken> sessionChange)
        {
            Requires.NotNull(sessionChange, nameof(sessionChange));
            // Debug.WriteLine("SessionChangeAnalayzer.FindChanges");

            //Check for new session
            if (sessionChange.OldValue == null)
            {
                return(ImmutableArray.Create(Change.SessionStart(sessionChange.NewValue.Id)));
            }
            else
            {
                return(GetSessionChanges(sessionChange).ToImmutableArray());
            }
        }
    public BattleMemberGroupStatusControl(Summary1 s1)
    {
        set1(s1);

        value_change1_1 = new ValueChange(s1);
        value_change1_2 = new ValueChange(s1);
        value_change2_1 = new ValueChange(s1);
        value_change2_2 = new ValueChange(s1);

        value_move1 = new ValueMove(s1);
        value_move2 = new ValueMove(s1);

        shake_move1 = new ShakeMove(s1);
        shake_move2 = new ShakeMove(s1);
    }
        private AttributeChange ApplyDelegateChanges(CSEntryChange csentry)
        {
            this.GetUserDelegateChanges(csentry, out IList <string> adds, out IList <string> deletes);

            if (adds.Count == 0 && deletes.Count == 0)
            {
                return(null);
            }

            AttributeChange     change       = null;
            IList <ValueChange> valueChanges = new List <ValueChange>();

            try
            {
                if (deletes != null)
                {
                    foreach (string delete in deletes)
                    {
                        Logger.WriteLine($"Removing delegate {delete}");
                        this.config.GmailService.RemoveDelegate(csentry.DN, delete);
                        valueChanges.Add(ValueChange.CreateValueDelete(delete));
                    }
                }

                foreach (string add in adds)
                {
                    Logger.WriteLine($"Adding delegate {add}");
                    this.config.GmailService.AddDelegate(csentry.DN, add);
                    valueChanges.Add(ValueChange.CreateValueAdd(add));
                }
            }
            finally
            {
                if (valueChanges.Count > 0)
                {
                    if (csentry.ObjectModificationType == ObjectModificationType.Update)
                    {
                        change = AttributeChange.CreateAttributeUpdate(this.attributeName, valueChanges);
                    }
                    else
                    {
                        change = AttributeChange.CreateAttributeAdd(this.attributeName, valueChanges.Where(u => u.ModificationType == ValueModificationType.Add).Select(t => t.Value).ToList());
                    }
                }
            }

            return(change);
        }
예제 #27
0
 DIP_SoftFilter()
 {
     Row       = 3;
     sigma_d   = 2;
     sigma_r   = 0.1;
     RGB_Range = new int[][] { new int[2] {
                                   200, 250
                               }, new int[2] {
                                   150, 200
                               }, new int[2] {
                                   120, 180
                               } };
     valueChange       += valueChangeEvent;
     filter             = Filter_TYPE.Mean_Value_Filter;
     valueFilterChange += valueChangeMeanEvent;
 }
예제 #28
0
        private void 滑条_ValueChanged(object sender, RangeBaseValueChangedEventArgs e)
        {
            Number         = (int)e.NewValue; //修改新Value
            button.Content = Number.ToString() + text;

            if (Number > Max)
            {
                Number = Max;
            }
            if (Number < Min)
            {
                Number = Min;
            }
            Value = Number;
            ValueChange?.Invoke(this, Number); //用户控件:Value改变
        }
예제 #29
0
        private void MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            int i = canvases.IndexOf((Canvas)sender);

            if (i >= 0)
            {
                if (curValues != null && i < curValues.Length)
                {
                    ValueChange.Invoke(canvases[i], new ValueChangeArgs()
                    {
                        Index = i,
                        Value = (curValues[i] > 0.5 ? 0.0 : 1.0)
                    });
                }
            }
        }
예제 #30
0
 /// <summary>
 /// Adds a reference to the source object on the specified target object
 /// </summary>
 /// <param name="sourceObject">The object to add a reference to</param>
 /// <param name="targetObject">The object to add the reference on</param>
 private void AddReference(MAObjectHologram sourceObject, MAObjectHologram targetObject)
 {
     if (this.BackLinkAttribute.IsMultivalued)
     {
         if (!targetObject.HasAttributeValue(this.BackLinkAttribute, sourceObject.ObjectID))
         {
             targetObject.UpdateAttributeValue(this.BackLinkAttribute, new List <ValueChange>()
             {
                 ValueChange.CreateValueAdd(sourceObject.ObjectID)
             });
         }
     }
     else
     {
         targetObject.SetAttributeValue(this.BackLinkAttribute, sourceObject.ObjectID);
     }
 }
예제 #31
0
 public static ValueChange[] Add(ValueChange n, ValueChange[] list)
 {
     ArrayList tmp = new ArrayList();
     foreach(ValueChange str in list) tmp.Add(str);
     tmp.Add(n);
     return tmp.ToArray(typeof(ValueChange)) as ValueChange[];
 }
예제 #32
0
 public static ValueChange[] Remove(int index, ValueChange[] list)
 {
     ArrayList tmp = new ArrayList();
     foreach(ValueChange str in list) tmp.Add(str);
     tmp.RemoveAt(index);
     return tmp.ToArray(typeof(ValueChange)) as ValueChange[];
 }
예제 #33
0
 public bool CompareTo(ValueChange vc)
 {
     bool same = false;
     if(this.active == vc.active &&
         this.simpleOperator.Equals(vc.simpleOperator) &&
         this.formulaChooser.Equals(vc.formulaChooser) &&
         this.value == vc.value &&
         this.status == vc.status &&
         this.formula == vc.formula &&
         this.randomMin == vc.randomMin &&
         this.randomMax == vc.randomMax &&
         this.efficiency == vc.efficiency &&
         this.cancelSkills == vc.cancelSkills &&
         this.blockable == vc.blockable &&
         this.ignoreDefend == vc.ignoreDefend &&
         this.ignoreElement == vc.ignoreElement &&
         this.ignoreRace == vc.ignoreRace &&
         this.ignoreSize == vc.ignoreSize)
     {
         same = true;
     }
     return same;
 }
예제 #34
0
    /*
    ============================================================================
    Settings functions
    ============================================================================
    */
    public static ValueChange ValueChangeSettings(int index, ValueChange vc)
    {
        vc.active = EditorGUILayout.BeginToggleGroup(DataHolder.StatusValues().GetName(index), vc.active);
        if(vc.active)
        {
            vc.simpleOperator = (SimpleOperator)EditorTab.EnumToolbar("Operator", (int)vc.simpleOperator, typeof(SimpleOperator));
            vc.formulaChooser = (FormulaChooser)EditorTab.EnumToolbar("", (int)vc.formulaChooser,
                    typeof(FormulaChooser), (int)(EditorHelper.mWidth*1.5f));
            if(FormulaChooser.VALUE.Equals(vc.formulaChooser))
            {
                vc.value = EditorGUILayout.IntField("Value", vc.value, GUILayout.Width(EditorHelper.mWidth));
            }
            else if(FormulaChooser.STATUS.Equals(vc.formulaChooser))
            {
                vc.status = EditorGUILayout.Popup("Status Value", vc.status,
                        DataHolder.StatusValues().GetNameList(true), GUILayout.Width(EditorHelper.mWidth));
            }
            else if(FormulaChooser.FORMULA.Equals(vc.formulaChooser))
            {
                vc.formula = EditorGUILayout.Popup("Formula", vc.formula,
                        DataHolder.Formulas().GetNameList(true), GUILayout.Width(EditorHelper.mWidth));
            }
            else if(FormulaChooser.RANDOM.Equals(vc.formulaChooser))
            {
                vc.randomMin = EditorGUILayout.IntField("Minimum", vc.randomMin, GUILayout.Width(EditorHelper.mWidth));
                vc.randomMax= EditorGUILayout.IntField("Maximum", vc.randomMax, GUILayout.Width(EditorHelper.mWidth));
            }
            vc.efficiency = EditorGUILayout.FloatField("Efficiency", vc.efficiency, GUILayout.Width(EditorHelper.mWidth));

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.BeginVertical();
            vc.cancelSkills = EditorGUILayout.Toggle("Cancel skills", vc.cancelSkills, GUILayout.Width(EditorHelper.mWidth));
            vc.blockable = EditorGUILayout.Toggle("Blockable", vc.blockable, GUILayout.Width(EditorHelper.mWidth));
            vc.ignoreDefend = EditorGUILayout.Toggle("Ignore defend", vc.ignoreDefend, GUILayout.Width(EditorHelper.mWidth));
            EditorGUILayout.EndVertical();
            EditorGUILayout.Separator();
            EditorGUILayout.BeginVertical();
            vc.ignoreElement = EditorGUILayout.Toggle("Ignore element", vc.ignoreElement, GUILayout.Width(EditorHelper.mWidth));
            vc.ignoreRace = EditorGUILayout.Toggle("Ignore race", vc.ignoreRace, GUILayout.Width(EditorHelper.mWidth));
            vc.ignoreSize = EditorGUILayout.Toggle("Ignore size", vc.ignoreSize, GUILayout.Width(EditorHelper.mWidth));
            EditorGUILayout.EndVertical();
            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();
        }
        EditorGUILayout.EndToggleGroup();
        EditorGUILayout.Separator();
        return vc;
    }