public static void EnsurePrefabIsPlayerRootCompatible(string name) { byte num; NetMainPrefab.EnsurePrefabName(name); if (!playerRootCompatibilityCache.TryGetValue(name, out num)) { ControllablePrefab prefab = NetMainPrefab.Lookup <ControllablePrefab>(name); if (prefab == null) { num = 0; } else if (!prefab.playerRootComapatable) { num = 2; } else { num = 1; } playerRootCompatibilityCache[name] = num; } switch (num) { case 0: throw new NonControllableException(name); case 2: throw new NonPlayerRootControllableException(name); } }
public static void EnsurePrefabName(string name) { NetMainPrefabNameException netMainPrefabNameException; if (!NetMainPrefab.ValidatePrefabNameOrMakeException(name, out netMainPrefabNameException)) { throw netMainPrefabNameException; } }
protected virtual void StandardInitialization(bool didAppend, IDRemote appended, NetInstance instance, Facepunch.NetworkView view, ref uLink.NetworkMessageInfo info) { if (didAppend) { NetMainPrefab.IssueLocallyAppended(appended, instance.idMain); } if (this.ShouldDoStandardInitialization(instance)) { NetworkInstantiatorUtility.BroadcastOnNetworkInstantiate(view, "uLink_OnNetworkInstantiate", info); } }
protected uLink.NetworkView _Creator(string prefabName, NetworkInstantiateArgs args, uLink.NetworkMessageInfo info) { NetInstance netInstance = this.Summon(this.proxyPrefab, false, ref args); if (!netInstance) { return(null); } Facepunch.NetworkView networkView = netInstance.networkView; if (!networkView) { return(null); } info = new uLink.NetworkMessageInfo(info, networkView); NetInstance netInstance1 = NetMainPrefab._currentNetInstance; try { NetMainPrefab._currentNetInstance = netInstance; netInstance.info = info; netInstance.prepared = true; netInstance.local = args.viewID.isMine; bool flag = false; IDRemote dRemote = null; if (netInstance.local) { IDRemote dRemote1 = this.localAppend; if (dRemote1) { dRemote = NetMainPrefab.DoLocalAppend(dRemote1, netInstance.idMain, this.GetLocalAppendTransform(netInstance.idMain)); flag = true; } } netInstance.zzz___onprecreate(); this.StandardInitialization(flag, dRemote, netInstance, networkView, ref info); netInstance.zzz___onpostcreate(); } finally { NetMainPrefab._currentNetInstance = netInstance1; } return(networkView); }
private static byte GetVesselCompatibility(string name) { byte vesselCompatibility; NetMainPrefab.EnsurePrefabName(name); if (!vesselCompatibilityCache.TryGetValue(name, out vesselCompatibility)) { ControllablePrefab prefab = NetMainPrefab.Lookup <ControllablePrefab>(name); if (prefab == null) { vesselCompatibility = 0; } else { vesselCompatibility = prefab.vesselCompatibility; } vesselCompatibilityCache[name] = vesselCompatibility; } return(vesselCompatibility); }
public static void EnsurePrefabIsAIRootCompatible(string name, out bool staticGroup) { sbyte num; NetMainPrefab.EnsurePrefabName(name); if (!aiRootCompatibilityCache.TryGetValue(name, out num)) { ControllablePrefab prefab = NetMainPrefab.Lookup <ControllablePrefab>(name); if (prefab == null) { num = 0; } else if (!prefab.aiRootComapatable) { num = 2; } else { num = !((Character)prefab.serverPrefab).controllable.classFlagsStaticGroup ? ((sbyte)1) : ((sbyte)(-1)); } aiRootCompatibilityCache[name] = num; } sbyte num2 = num; switch ((num2 + 1)) { case 0: staticGroup = true; return; case 2: staticGroup = false; return; case 3: throw new NonAIRootControllableException(name); } throw new NonControllableException(name); }
private CustomInstantiationArgs(NetMainPrefab netMain, UnityEngine.Object customInstantiator, IDMain prefab, ref NetworkInstantiateArgs args, bool server, bool checkCustomInstantitorArgument) { this.netMain = netMain; this.prefab = prefab; this.prefabNetworkView = prefab.networkView; this.args = args; this.server = server; if (!checkCustomInstantitorArgument || !customInstantiator) { this.hasCustomInstantiator = CustomInstantiationArgs.CheckNetworkViewCustomInstantiator(this.prefabNetworkView, this.prefab, out this.customInstantiate); } else { this.customInstantiate = customInstantiator as IPrefabCustomInstantiate; if (this.customInstantiate != null) { this.hasCustomInstantiator = true; } else { this.hasCustomInstantiator = CustomInstantiationArgs.CheckNetworkViewCustomInstantiator(this.prefabNetworkView, this.prefab, out this.customInstantiate); } } }
private CustomInstantiationArgs(NetMainPrefab netMain, Object customInstantiator, IDMain prefab, ref NetworkInstantiateArgs args, bool server, bool checkCustomInstantitorArgument) { this.netMain = netMain; this.prefab = prefab; this.prefabNetworkView = prefab.networkView; this.args = args; this.server = server; if (checkCustomInstantitorArgument && (customInstantiator != null)) { this.customInstantiate = customInstantiator as IPrefabCustomInstantiate; if (this.customInstantiate == null) { this.hasCustomInstantiator = CheckNetworkViewCustomInstantiator(this.prefabNetworkView, this.prefab, out this.customInstantiate); } else { this.hasCustomInstantiator = true; } } else { this.hasCustomInstantiator = CheckNetworkViewCustomInstantiator(this.prefabNetworkView, this.prefab, out this.customInstantiate); } }
public CustomInstantiationArgs(NetMainPrefab netMain, UnityEngine.Object customInstantiator, IDMain prefab, ref NetworkInstantiateArgs args, bool server) : this(netMain, customInstantiator, prefab, ref args, server, true) { }
public CustomInstantiationArgs(NetMainPrefab netMain, IDMain prefab, ref NetworkInstantiateArgs args, bool server) : this(netMain, null, prefab, ref args, server, false) { }
public CustomInstantiationArgs(NetMainPrefab netMain, Object customInstantiator, IDMain prefab, ref NetworkInstantiateArgs args, bool server) : this(netMain, customInstantiator, prefab, ref args, server, true) { }
public Transform GetLocalAppendTransform(IDMain instanceOrPrefab) { return(NetMainPrefab.GetLocalAppendTransform(instanceOrPrefab, this._pathToLocalAppend)); }