예제 #1
0
 private void InitializeController_OnFoundOverriding(Facepunch.NetworkView driverView)
 {
     Controllable.ControlFlags controlFlag;
     if ((int)(this.F & Controllable.ControlFlags.Root) != 0)
     {
         Controllable controllable = this;
         Controllable.ControlFlags f = controllable.F;
         if (!this.__networkViewForControllable.isMine)
         {
             controlFlag = (Controllable.ControlFlags)0;
         }
         else
         {
             controlFlag = Controllable.ControlFlags.Local;
         }
         controllable.F = f | controlFlag;
         Controllable f1 = this;
         f1.F = f1.F | (!PlayerClient.Find(this.__networkViewForControllable.owner, out this._playerClient) ? Controllable.ControlFlags.Owned : Controllable.ControlFlags.Owned | Controllable.ControlFlags.Player);
     }
     else
     {
         Controllable controllable1 = (driverView.idMain as Character).controllable;
         this.F = this.F & (Controllable.ControlFlags.Root | Controllable.ControlFlags.Strong) | controllable1.F & (Controllable.ControlFlags.Local | Controllable.ControlFlags.Player);
         this._playerClient = controllable1.playerClient;
         controllable1.ch.Add(this);
     }
     Controllable f2 = this;
     f2.F = f2.F | Controllable.ControlFlags.Owned;
     string str = this.controllerClassName;
     if (string.IsNullOrEmpty(str))
     {
         Controllable.ControlFlags controlFlag1 = this.F;
         this.F = (Controllable.ControlFlags)0;
         throw new ArgumentOutOfRangeException("@class", (object)controlFlag1, "The ControllerClass did not support given flags");
     }
     Controller controller = null;
     try
     {
         controller = base.AddAddon<Controller>(str);
         if (!controller)
         {
             throw new ArgumentOutOfRangeException("className", str, "classname as not a Controller!");
         }
         this._controller = controller;
         Controller controller1 = this._controller;
         try
         {
             try
             {
                 this._controller.ControllerSetup(this, this.__networkViewForControllable, ref this.__controllerCreateMessageInfo);
             }
             catch
             {
                 this._controller = controller1;
                 throw;
             }
         }
         catch
         {
             throw;
         }
         Controllable controllable2 = this;
         controllable2.F = controllable2.F | Controllable.ControlFlags.Initialized;
     }
     catch
     {
         if (controller)
         {
             UnityEngine.Object.Destroy(controller);
         }
         this.ch.Delete();
         throw;
     }
 }
예제 #2
0
 internal void FreshInitializeController()
 {
     if (this.__controllerDriverViewID != uLink.NetworkViewID.unassigned)
     {
         Facepunch.NetworkView networkView = Facepunch.NetworkView.Find(this.__controllerDriverViewID);
         Controllable f = this;
         f.F = (Controllable.ControlFlags)((int)f.F | 0);
         this.InitializeController_OnFoundOverriding(networkView);
     }
     else
     {
         if ((this.F & Controllable.ControlFlags.Initialized) == Controllable.ControlFlags.Initialized)
         {
             throw new InvalidOperationException("Was already intialized.");
         }
         Controllable.Chain.ROOT(this);
         this.F = Controllable.ControlFlags.Root;
         this.InitializeController_OnFoundOverriding(null);
     }
 }