예제 #1
0
    // Token: 0x0600216E RID: 8558 RVA: 0x0007AEFC File Offset: 0x000790FC
    private Facepunch.NetworkView Create(ref global::CustomInstantiationArgs args, out IDMain instance)
    {
        if (float.IsNaN(args.position.x) || float.IsNaN(args.position.y) || float.IsNaN(args.position.z))
        {
            Debug.LogWarning("NetMainPrefab -> Create -  args.position = " + args.position);
            Debug.LogWarning("This means you're creating an object with a bad position!");
        }
        global::NetInstance currentNetInstance = global::NetMainPrefab._currentNetInstance;

        Facepunch.NetworkView result;
        try
        {
            global::NetMainPrefab._currentNetInstance = null;
            if (args.hasCustomInstantiator)
            {
                instance = null;
                try
                {
                    instance = args.customInstantiate.CustomInstantiatePrefab(ref args);
                }
                catch (Exception arg)
                {
                    Debug.LogError(string.Format("Thrown Exception during custom instantiate via '{0}' with instantiation '{2}'\r\ndefault instantiation will now occur --  exception follows..\r\n{1}", args.customInstantiate, arg, this), this);
                    if (instance)
                    {
                        Object.Destroy(instance);
                    }
                    instance = null;
                }
                Facepunch.NetworkView networkView;
                try
                {
                    networkView = instance.networkView;
                    if (networkView == null)
                    {
                        Debug.LogWarning(string.Format("The custom instantiator '{0}' with instantiation '{1}' did not return a idmain with a network view. so its being added", args.customInstantiate, this), this);
                        networkView = instance.gameObject.AddComponent <uLinkNetworkView>();
                    }
                }
                catch (Exception arg2)
                {
                    networkView = null;
                    Debug.LogError(string.Format("The custom instantiator '{0}' did not instantiate a IDMain with a networkview or something else with instantiation '{2}'.. \r\n {1}", args.customInstantiate, arg2, this), this);
                }
                if (networkView)
                {
                    return(networkView);
                }
            }
            Facepunch.NetworkView networkView2 = (Facepunch.NetworkView)NetworkInstantiatorUtility.Instantiate(args.prefabNetworkView, args.args);
            instance = networkView2.GetComponent <IDMain>();
            result   = networkView2;
        }
        finally
        {
            global::NetMainPrefab._currentNetInstance = currentNetInstance;
        }
        return(result);
    }
예제 #2
0
    // Token: 0x0600216F RID: 8559 RVA: 0x0007B0D0 File Offset: 0x000792D0
    private global::NetInstance Summon(IDMain prefab, bool isServer, ref NetworkInstantiateArgs niargs)
    {
        global::CustomInstantiationArgs args = new global::CustomInstantiationArgs(this, this._customInstantiator, prefab, ref niargs, isServer);
        IDMain idMain;

        Facepunch.NetworkView networkView = this.Create(ref args, out idMain);
        global::NetInstance   netInstance = networkView.gameObject.AddComponent <global::NetInstance>();

        netInstance.args        = args;
        netInstance.idMain      = idMain;
        netInstance.prepared    = false;
        netInstance.networkView = networkView;
        return(netInstance);
    }
 // Token: 0x06002180 RID: 8576 RVA: 0x0007B85C File Offset: 0x00079A5C
 public CustomInstantiationArgs(global::NetMainPrefab netMain, IDMain prefab, ref NetworkInstantiateArgs args, bool server)
 {
     this = new global::CustomInstantiationArgs(netMain, null, prefab, ref args, server, false);
 }
 // Token: 0x06002181 RID: 8577 RVA: 0x0007B86C File Offset: 0x00079A6C
 public CustomInstantiationArgs(global::NetMainPrefab netMain, Object customInstantiator, IDMain prefab, ref NetworkInstantiateArgs args, bool server)
 {
     this = new global::CustomInstantiationArgs(netMain, customInstantiator, prefab, ref args, server, true);
 }