コード例 #1
0
ファイル: BoolVarGroup.cs プロジェクト: met44/uStableObject
 public void                         AddMember(BoolVar member)
 {
     if (!this._members.Contains(member))
     {
         this._members.Add(member);
         member.Register(this);
     }
 }
コード例 #2
0
ファイル: BoolVarGroup.cs プロジェクト: met44/uStableObject
        public void                         OnEventRaised(bool param)
        {
            if (!this._togglingGroup)
            {
                this._togglingGroup = true;
                try
                {
                    this._prevToggledOnMember = this._toggledOnMember;

                    //switch off previous
                    if (this._toggledOnMember != null)
                    {
                        if (this._toggledOnMember != this._fallbackMember || param)
                        {
                            this._toggledOnMember.Value = false;
                            this._toggledOnMember       = null;
                        }
                    }
                    if (param)
                    {
                        foreach (var member in this._members)
                        {
                            if (member.Value)
                            {
                                this._toggledOnMember = member;
                                break;
                            }
                        }
                    }
                    if (this._toggledOnMember == null && this._fallbackMember != null)
                    {
                        this._toggledOnMember       = this._fallbackMember;
                        this._toggledOnMember.Value = true;
                    }
                    base.Value = this._toggledOnMember != null;
                }
                catch (System.Exception ex)
                {
                    Debug.LogException(ex);
                }
                this._togglingGroup = false;
            }
        }
コード例 #3
0
ファイル: BoolVarGroup.cs プロジェクト: met44/uStableObject
 void                                OnEnable()
 {
     this._toggledOnMember = null;
     foreach (var member in this._members)
     {
         if (member.Value)
         {
             if (this._toggledOnMember == null)
             {
                 this._toggledOnMember = member;
             }
             else
             {
                 member.Value = false;
             }
         }
         member.Register(this);
     }
     if (this._toggledOnMember == null && this._fallbackMember != null)
     {
         this._fallbackMember.Value = true;
         this._toggledOnMember      = this._fallbackMember;
     }
 }
コード例 #4
0
ファイル: BoolVarGroup.cs プロジェクト: met44/uStableObject
 public void                         RemoveMember(BoolVar member)
 {
     this._members.Remove(member);
     member.Unregister(this);
 }