Exemple #1
0
 public static void Register()
 {
     PhotonPeer.RegisterType(typeof(Vector2), (byte)'W', SerializeVector2, DeserializeVector2);
     PhotonPeer.RegisterType(typeof(Vector3), (byte)'V', SerializeVector3, DeserializeVector3);
     PhotonPeer.RegisterType(typeof(Transform), (byte)'T', SerializeTransform, DeserializeTransform);
     PhotonPeer.RegisterType(typeof(Quaternion), (byte)'Q', SerializeQuaternion, DeserializeQuaternion);
 }
            private IEnumerator Logout()
            {
                Protocol.TypeDict.Remove(typeof(LogoutType));
                Protocol.CodeDict.Remove(102);

#if STEAM
                SerializeMethod   serializeMethod   = new SerializeMethod(AADBLALKGMG.LDCIBGFMECI);
                DeserializeMethod deserializeMethod = new DeserializeMethod(AADBLALKGMG.JDJKKLNPMNA);
#elif OCULUS
                SerializeMethod   serializeMethod   = new SerializeMethod(AADBLALKGMG.LDCIBGFMECI);
                DeserializeMethod deserializeMethod = new DeserializeMethod(AADBLALKGMG.JDJKKLNPMNA);
#endif

                PhotonPeer.RegisterType(typeof(LogoutType), (byte)102, new SerializeMethod(SerializeThisFunction), deserializeMethod);

                PhotonView photonView = PhotonView.Get(VRC_EventLog.Instance.Replicator);

                for (int i = 0; i < 10; i++)
                {
                    try
                    {
                        if (Targets[0] != null)
                        {
                            photonView.RpcSecure("ProcessEvent", Targets[0], true, new object[]
                            {
#if STEAM
                                new VRC_EventLog.INGKOGDACII()
#elif OCULUS
                                new VRC_EventLog.INGKOGDACII()
#endif
                            });
                        }
                    }
Exemple #3
0
 public override void OnConnectedToMaster()
 {
     PhotonNetwork.NickName = State.UserProfile.username;
     //PlayerNetwork.Instance.PlayerName;
     Debug.Log(PhotonNetwork.NickName + " Connected to " + PhotonNetwork.CloudRegion + " Server");
     PhotonPeer.RegisterType(typeof(CardSerializer), (byte)'M', CardSerializer.Serialize, CardSerializer.Deserialize);
 }
Exemple #4
0
        public static void RegisterTypes(this PhotonClient client)
        {
            Type              typeFromHandle = typeof(Vector3);
            byte              code           = 86;
            SerializeMethod   Serialize1     = new SerializeMethod(JFAFAPNBFLC);
            DeserializeMethod DeSerialize1   = new DeserializeMethod(IKFICLDHAOI);

            PhotonPeer.RegisterType(typeFromHandle, code, Serialize1, DeSerialize1);
            Type              typeFromHandle2 = typeof(Quaternion);
            byte              code2           = 81;
            SerializeMethod   Serialize2      = new SerializeMethod(FECGOFBPKPP);
            DeserializeMethod DeSerialize2    = new DeserializeMethod(KCFONHKNDJH);

            PhotonPeer.RegisterType(typeFromHandle2, code2, Serialize2, DeSerialize2);
            byte              b = 100;
            Type              typeFromHandle3 = typeof(Vector2);
            SerializeMethod   Serialize3      = new SerializeMethod(KMIBNBFAHEN);
            DeserializeMethod DeSerialize3    = new DeserializeMethod(HHBPLJKDKPI);

            GCJHKDFNJEA(typeFromHandle3, ref b, Serialize3, DeSerialize3);
            Type              typeFromHandle4 = typeof(Vector4);
            SerializeMethod   Serialize4      = new SerializeMethod(DFMLPAEPHJD);
            DeserializeMethod DeSerialize4    = new DeserializeMethod(GPJDPFFENPL);

            GCJHKDFNJEA(typeFromHandle4, ref b, Serialize4, DeSerialize4);
        }
Exemple #5
0
        /// <summary>
        /// Register serialization & deserialization mechanisms for transmitting the given class by ID.
        /// The given class does not need to implements its own serialization logic.
        /// </summary>
        public static void RegisterSerializerAndDeserializer(Type type)
        {
            int id = NetworkableId <Type> .ToId(type);

            Debug.Log("Using id " + id + " for tagging of class " + type.Name + " in network messages when sending/receiving NetworkableById types");

            // Construct SerializerAndDeserializer<type>

            Type serializerAndDeserializerType            = typeof(SerializerAndDeserializer <>);
            Type serializerAndDeserializerTypeSpecialized = serializerAndDeserializerType.MakeGenericType(type);

            // Find a method Serialize(StreamBuffer, object) in SerializerAndDeserializer<type>

            MethodInfo serializeMethodInfo = serializerAndDeserializerTypeSpecialized.GetMethod("Serialize", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public, null, new Type[] { typeof(StreamBuffer), typeof(object) }, null);

            Assert.IsNotNull(serializeMethodInfo, "Unable to find virtual Serialize(StreamBuffer, object) method in " + serializerAndDeserializerTypeSpecialized.Name);
            SerializeStreamMethod serializer = (SerializeStreamMethod)Delegate.CreateDelegate(typeof(SerializeStreamMethod), serializeMethodInfo);

            // Find a method Deserialize(StreamBuffer, short) in SerializerAndDeserializer<type>

            MethodInfo deserializeMethodInfo = serializerAndDeserializerTypeSpecialized.GetMethod("Deserialize", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public, null, new Type[] { typeof(StreamBuffer), typeof(short) }, null);

            Assert.IsNotNull(serializeMethodInfo, "Unable to find static Deserialize(StreamBuffer, short) method in " + serializerAndDeserializerTypeSpecialized.Name);
            DeserializeStreamMethod deserializer = (DeserializeStreamMethod)Delegate.CreateDelegate(typeof(DeserializeStreamMethod), deserializeMethodInfo);

            // Register serializer and deserializer methods for class

            bool success = PhotonPeer.RegisterType(type, (byte)id, serializer, deserializer);

            Assert.IsTrue(success, "Failed registering new serialization type for " + type.Name + " with code " + id);
        }
Exemple #6
0
 /// <summary>Register</summary>
 internal static void Register()
 {
     PhotonPeer.RegisterType(typeof(Vector2), (byte)'W', SerializeVector2, DeserializeVector2);
     PhotonPeer.RegisterType(typeof(Vector3), (byte)'V', SerializeVector3, DeserializeVector3);
     PhotonPeer.RegisterType(typeof(Quaternion), (byte)'Q', SerializeQuaternion, DeserializeQuaternion);
     PhotonPeer.RegisterType(typeof(PhotonPlayer), (byte)'P', SerializePhotonPlayer, DeserializePhotonPlayer);
 }
Exemple #7
0
 internal static void Register()
 {
     PhotonPeer.RegisterType(typeof(Vector2), 0x57, new SerializeMethod(CustomTypes.SerializeVector2), new DeserializeMethod(CustomTypes.DeserializeVector2));
     PhotonPeer.RegisterType(typeof(Vector3), 0x56, new SerializeMethod(CustomTypes.SerializeVector3), new DeserializeMethod(CustomTypes.DeserializeVector3));
     PhotonPeer.RegisterType(typeof(Quaternion), 0x51, new SerializeMethod(CustomTypes.SerializeQuaternion), new DeserializeMethod(CustomTypes.DeserializeQuaternion));
     PhotonPeer.RegisterType(typeof(PhotonPlayer), 80, new SerializeMethod(CustomTypes.SerializePhotonPlayer), new DeserializeMethod(CustomTypes.DeserializePhotonPlayer));
 }
Exemple #8
0
 public static void Register()
 {
     PhotonPeer.RegisterType(typeof(Vector2), (byte)'V', SerializeVector2, DeserializeVector2);
     PhotonPeer.RegisterType(typeof(Vector3), (byte)'W', SerializeVector3, DeserializeVector3);
     PhotonPeer.RegisterType(typeof(Quaternion), (byte)'Q', SerializeQuaternion, DeserializeQuaternion);
     PhotonPeer.RegisterType(typeof(char), (byte)'c', SerializeChar, DeserializeChar);
 }
    void Start()
    {
        PhotonPeer.RegisterType(typeof(Usercmd), 2, Usercmd.Serialize, Usercmd.Deserialize);

        controller = GetComponent <CharacterController>();
        animat     = GetComponent <Animator>();
        photonView = GetComponent <PhotonView>();
        Destroy(playerCamera);
        Destroy(playerAudio);
        controller.detectCollisions = false;
        BotState = BotState.Standing;

        LaserObject = Instantiate(LaserEffect, rayOrgin);
        LaserObject.SetActive(false);
        history = new List <Usercmd>();
        PredictionToBeAccepted = new List <Usercmd>();
        toSend       = new Queue <Usercmd>();
        ReciveBuffor = new Queue <Usercmd>();
        Usercmd currentCommand             = new Usercmd();
        Usercmd targetInterpolationCommand = new Usercmd();

        StartTime   = PhotonNetwork.Time;
        MyLocalTime = Time.time;

        CSDiffrence       = Vector3.zero;
        AppliedCorrection = Vector3.zero;

        logfile = new StringBuilder();
        var newLine = string.Format("{0}:{1}:{2}:{3}:{4}:{5}", "Index", "PostionX", "PostionY", "PostionZ", "RotationAngle", "PhotonTime");

        logfile.AppendLine(newLine);

        PhotonNetwork.SendRate          = 80;
        PhotonNetwork.SerializationRate = 80;
    }
Exemple #10
0
 internal static void Register()
 {
     PhotonPeer.RegisterType(typeof(Vector2), 87, SerializeVector2, DeserializeVector2);
     PhotonPeer.RegisterType(typeof(Vector3), 86, SerializeVector3, DeserializeVector3);
     PhotonPeer.RegisterType(typeof(Quaternion), 81, SerializeQuaternion, DeserializeQuaternion);
     PhotonPeer.RegisterType(typeof(PhotonPlayer), 80, SerializePhotonPlayer, DeserializePhotonPlayer);
 }
Exemple #11
0
 internal static void Register()
 {
     PhotonPeer.RegisterType(typeof(Quaternion), 81, new SerializeStreamMethod(SerializeQuaternion), new DeserializeStreamMethod(DeserializeQuaternion));
     PhotonPeer.RegisterType(typeof(Vector2), 87, new SerializeStreamMethod(SerializeVector2), new DeserializeStreamMethod(DeserializeVector2));
     PhotonPeer.RegisterType(typeof(Vector3), 86, new SerializeStreamMethod(SerializeVector3), new DeserializeStreamMethod(DeserializeVector3));
     PhotonPeer.RegisterType(typeof(PhotonPlayer), 80, new SerializeStreamMethod(SerializePhotonPlayer), new DeserializeStreamMethod(DeserializePhotonPlayer));
 }
 // Start is called before the first frame update
 void Start()
 {
     PhotonPeer.RegisterType(typeof(SerializeData), (byte)'Z', SerializeData.Serialize, SerializeData.Deserialize);
     PhotonPeer.RegisterType(typeof(SerializeSlimeData), (byte)'Y', SerializeSlimeData.SerializeSlime, SerializeSlimeData.DeserializeSlime);
     PhotonPeer.RegisterType(typeof(PlayerData), (byte)'X', PlayerData.Serialize, PlayerData.Deserialize);
     pi = GameObject.Find("PlayerInfo").GetComponent<PlayerInfo>();
 }
Exemple #13
0
        /*Private methods*/

        private void Awake()
        {
            //Register custom classes that will be sent between clients
            PhotonPeer.RegisterType(typeof(SharedProject), NetworkingData.PROJECT_BYTE_CODE, SharedProject.Serialize, SharedProject.Deserialize);
            //Needed to register both base and derived class of worker because photon API requires
            //derived class to be register event when using base class argument in method
            PhotonPeer.RegisterType(typeof(LocalWorker), NetworkingData.LOCAL_WORKER_BYTE_CODE, SharedWorker.Serialize, SharedWorker.Deserialize);
            PhotonPeer.RegisterType(typeof(SharedWorker), NetworkingData.SHARED_WORKER_BYTE_CODE, SharedWorker.Serialize, SharedWorker.Deserialize);

            DontDestroyOnLoad(this.gameObject);
            PhotonNetwork.offlineMode = this.OfflineMode;
            this.photonView.viewID    = 1;
            PlayerInfo.Load();
            //In PUN Classic, if the client does not set a UserId,
            //the UserId will be set to the Nickname before connecting. In PUN2 this is no longer the case.
            string userID = Guid.NewGuid().ToString();

            PhotonNetwork.AuthValues = new AuthenticationValues(userID);

            if (false == PhotonNetwork.offlineMode)
            {
                PhotonNetwork.ConnectUsingSettings(GAME_VERSION);
            }

            PhotonNetwork.OnEventCall += PhotonNetworkOnEventCall;
            SceneManager.sceneLoaded  += OnSceneLoaded;
        }
Exemple #14
0
 // カスタムタイプを登録するメソッド(起動時に一度だけ呼び出す)
 public static void Register()
 {
     PhotonPeer.RegisterType(typeof(MaxTeamCount), 1, SerializeMaxTeamCount, DeserializeMaxTeamCount);
     PhotonPeer.RegisterType(typeof(MatchTime), 2, SerializeMatchTime, DeserializeMatchTime);
     PhotonPeer.RegisterType(typeof(BoardSize), 3, SerializeBoardSize, DeserializeBoardSize);
     PhotonPeer.RegisterType(typeof(uint), 4, SerializeUint, DeserializeUint);
 }
Exemple #15
0
    private void Awake()
    {
        mainCamera  = Camera.main;
        audioSource = GetComponent <AudioSource>();

        PhotonView = PhotonView.Get(this);
        PhotonPeer.RegisterType(typeof(CustomTile), (byte)'A', SerializedCustomTile.Serialize, SerializedCustomTile.Deserialize);

        Instance = this;
        Origin   = new Vector2Int(-WorldSize.x / 2, -WorldSize.y / 2);

        oreDictionary = new Dictionary <BlockType, List <Vector2Int> >
        {
            { BlockType.IRON, new List <Vector2Int>() },
            { BlockType.COPPER, new List <Vector2Int>() },
            { BlockType.GOLD, new List <Vector2Int>() }
        };

        AstroRock.origin     = new Vector3Int(0, 0, 0);
        AstroOre.origin      = new Vector3Int(0, 0, 0);
        AstroMineable.origin = new Vector3Int(0, 0, 0);

        Map   = new CustomTile[WorldSize.x, WorldSize.y];
        Print = new CustomTile[WorldSize.x, WorldSize.y];

        nbPlayersReady    = 0;
        nbPlayersGenerate = 0;
        spawnPositions    = new List <Vector2>();
    }
 void Awake()
 {
     if (!PhotonPeer.RegisterType(typeof(ResourceStorage), (byte)'L', ResourceStorage.Serialize, ResourceStorage.Deserialize))
     {
         throw new Exception("Was not able to register ResourceStorage to Photon");
     }
 }
Exemple #17
0
    // Token: 0x06005379 RID: 21369 RVA: 0x001CCB54 File Offset: 0x001CAF54
    internal static void Register()
    {
        Debug.Log("Registering Custom Photon Objets");
        Type typeFromHandle = typeof(ApiAvatar);
        byte code           = 66;

        if (PhotonCustomTypes.f__mg0 == null)
        {
            PhotonCustomTypes.f__mg0 = new SerializeMethod(PhotonCustomTypes.SerializeApiAvatar);
        }
        SerializeMethod serializeMethod = PhotonCustomTypes.f__mg0;

        if (PhotonCustomTypes.f__mg1 == null)
        {
            PhotonCustomTypes.f__mg1 = new DeserializeMethod(PhotonCustomTypes.DeserializeApiAvatar);
        }
        PhotonPeer.RegisterType(typeFromHandle, code, serializeMethod, PhotonCustomTypes.f__mg1);
        Type typeFromHandle2 = typeof(ApiWorld);
        byte code2           = 87;

        if (PhotonCustomTypes.f__mg2 == null)
        {
            PhotonCustomTypes.f__mg2 = new SerializeMethod(PhotonCustomTypes.SerializeApiWorld);
        }
        SerializeMethod serializeMethod2 = PhotonCustomTypes.f__mg2;

        if (PhotonCustomTypes.f__mg3 == null)
        {
            PhotonCustomTypes.f__mg3 = new DeserializeMethod(PhotonCustomTypes.DeserializeApiWorld);
        }
        PhotonPeer.RegisterType(typeFromHandle2, code2, serializeMethod2, PhotonCustomTypes.f__mg3);
    }
Exemple #18
0
    void Start()
    {
        history       = new List <Usercmd>();
        ServerHistory = new List <Usercmd>();
        controller    = GetComponent <CharacterController>();
        animat        = GetComponent <Animator>();
        photonView    = GetComponent <PhotonView>();
        Destroy(playerCamera);
        Destroy(playerAudio);

        LaserObject = Instantiate(LaserEffect, rayOrgin);
        LaserObject.SetActive(false);

        controller.detectCollisions = false;

        BotState = BotState.Standing;

        StartTime   = PhotonNetwork.Time;
        MyLocalTime = Time.time;

        PhotonPeer.RegisterType(typeof(Usercmd), 2, Usercmd.Serialize, Usercmd.Deserialize);

        PhotonNetwork.SendRate          = 60;
        PhotonNetwork.SerializationRate = 60;
    }
Exemple #19
0
    // Token: 0x06003B8E RID: 15246 RVA: 0x0012B9A0 File Offset: 0x00129DA0
    internal static void Register()
    {
        Type typeFromHandle = typeof(Vector2);
        byte code           = 87;

        if (CustomTypes.f__mg == null)
        {
            CustomTypes.f__mg = new SerializeStreamMethod(CustomTypes.SerializeVector2);
        }
        SerializeStreamMethod serializeMethod = CustomTypes.f__mg;

        if (CustomTypes.f__mg1 == null)
        {
            CustomTypes.f__mg1 = new DeserializeStreamMethod(CustomTypes.DeserializeVector2);
        }
        PhotonPeer.RegisterType(typeFromHandle, code, serializeMethod, CustomTypes.f__mg1);
        Type typeFromHandle2 = typeof(Vector3);
        byte code2           = 86;

        if (CustomTypes.f__mg2 == null)
        {
            CustomTypes.f__mg2 = new SerializeStreamMethod(CustomTypes.SerializeVector3);
        }
        SerializeStreamMethod serializeMethod2 = CustomTypes.f__mg2;

        if (CustomTypes.f__mg3 == null)
        {
            CustomTypes.f__mg3 = new DeserializeStreamMethod(CustomTypes.DeserializeVector3);
        }
        PhotonPeer.RegisterType(typeFromHandle2, code2, serializeMethod2, CustomTypes.f__mg3);
        Type typeFromHandle3 = typeof(Quaternion);
        byte code3           = 81;

        if (CustomTypes.f__mg4 == null)
        {
            CustomTypes.f__mg4 = new SerializeStreamMethod(CustomTypes.SerializeQuaternion);
        }
        SerializeStreamMethod serializeMethod3 = CustomTypes.f__mg4;

        if (CustomTypes.f__mg5 == null)
        {
            CustomTypes.f__mg5 = new DeserializeStreamMethod(CustomTypes.DeserializeQuaternion);
        }
        PhotonPeer.RegisterType(typeFromHandle3, code3, serializeMethod3, CustomTypes.f__mg5);
        Type typeFromHandle4 = typeof(PhotonPlayer);
        byte code4           = 80;

        if (CustomTypes.f__mg6 == null)
        {
            CustomTypes.f__mg6 = new SerializeStreamMethod(CustomTypes.SerializePhotonPlayer);
        }
        SerializeStreamMethod serializeMethod4 = CustomTypes.f__mg6;

        if (CustomTypes.f__mg7 == null)
        {
            CustomTypes.f__mg7 = new DeserializeStreamMethod(CustomTypes.DeserializePhotonPlayer);
        }
        PhotonPeer.RegisterType(typeFromHandle4, code4, serializeMethod4, CustomTypes.f__mg7);
    }
    // Token: 0x0600AC81 RID: 44161 RVA: 0x003FAE4C File Offset: 0x003F904C
    internal static void FJPBNMBIOHG()
    {
        Type typeFromHandle = typeof(Vector2);
        byte code           = 87;

        if (GOLJCGMCKMG.BOGJGOAMCHK == null)
        {
            GOLJCGMCKMG.BOGJGOAMCHK = new SerializeStreamMethod(GOLJCGMCKMG.LCNMHEMBEFI);
        }
        SerializeStreamMethod bogjgoamchk = GOLJCGMCKMG.BOGJGOAMCHK;

        if (GOLJCGMCKMG.BDPNFNJNEFM == null)
        {
            GOLJCGMCKMG.BDPNFNJNEFM = new DeserializeStreamMethod(GOLJCGMCKMG.HANJLNGFAKP);
        }
        PhotonPeer.RegisterType(typeFromHandle, code, bogjgoamchk, GOLJCGMCKMG.BDPNFNJNEFM);
        Type typeFromHandle2 = typeof(Vector3);
        byte code2           = 86;

        if (GOLJCGMCKMG.MJKNAFJKDMG == null)
        {
            GOLJCGMCKMG.MJKNAFJKDMG = new SerializeStreamMethod(GOLJCGMCKMG.ANBBLBLNDBH);
        }
        SerializeStreamMethod mjknafjkdmg = GOLJCGMCKMG.MJKNAFJKDMG;

        if (GOLJCGMCKMG.JENGHDFDLII == null)
        {
            GOLJCGMCKMG.JENGHDFDLII = new DeserializeStreamMethod(GOLJCGMCKMG.BFLLDNIBMHP);
        }
        PhotonPeer.RegisterType(typeFromHandle2, code2, mjknafjkdmg, GOLJCGMCKMG.JENGHDFDLII);
        Type typeFromHandle3 = typeof(Quaternion);
        byte code3           = 81;

        if (GOLJCGMCKMG.BMJHMBNEACI == null)
        {
            GOLJCGMCKMG.BMJHMBNEACI = new SerializeStreamMethod(GOLJCGMCKMG.PKPCNJJBOJB);
        }
        SerializeStreamMethod bmjhmbneaci = GOLJCGMCKMG.BMJHMBNEACI;

        if (GOLJCGMCKMG.EPENHHMDDMB == null)
        {
            GOLJCGMCKMG.EPENHHMDDMB = new DeserializeStreamMethod(GOLJCGMCKMG.BNPJAGNEBPN);
        }
        PhotonPeer.RegisterType(typeFromHandle3, code3, bmjhmbneaci, GOLJCGMCKMG.EPENHHMDDMB);
        Type typeFromHandle4 = typeof(PhotonPlayer);
        byte code4           = 80;

        if (GOLJCGMCKMG.DNLDPCIINIC == null)
        {
            GOLJCGMCKMG.DNLDPCIINIC = new SerializeStreamMethod(GOLJCGMCKMG.AJKFOONFMDK);
        }
        SerializeStreamMethod dnldpciinic = GOLJCGMCKMG.DNLDPCIINIC;

        if (GOLJCGMCKMG.ILAKDECCIME == null)
        {
            GOLJCGMCKMG.ILAKDECCIME = new DeserializeStreamMethod(GOLJCGMCKMG.AEKFJLLFGFB);
        }
        PhotonPeer.RegisterType(typeFromHandle4, code4, dnldpciinic, GOLJCGMCKMG.ILAKDECCIME);
    }
Exemple #21
0
 private void Awake()
 {
     Instance = this;
     // photonView = GetComponent<PhotonView>();
     PhotonPeer.RegisterType(typeof(Card), (byte)'C', Card.SerializeCard, Card.DeserializeCard);
     TurnManagerListener = this;
     TurnDuration        = -1f;
 }
 void Awake()
 {
     DontDestroyOnLoad(gameObject);
     RegisterPacketType.RegisterPackets((customType, code, serializeMethod, deserializeMethod) =>
     {
         return(PhotonPeer.RegisterType(customType, code, (arg) => serializeMethod?.Invoke(arg), (arg) => deserializeMethod?.Invoke(arg)));
     });
 }
Exemple #23
0
 private void Start()
 {
     _chatClient            = new ChatClient(new ChatListener(this));
     _chatClient.ChatRegion = "US";
     _authValue             = new AuthenticationValues(ServiceManager.PlayerManager.LocalPlayerProfile.Uid);
     _chatClient.Connect(ChatAppId, ChatAppVersion, _authValue);
     PhotonPeer.RegisterType(typeof(PlayerInfoMessage), PlayerInfoMessage.Id, PlayerInfoMessage.Serialize, PlayerInfoMessage.Deserialize);
 }
Exemple #24
0
 void OnConnectedToPhoton()
 {
     m_connectedToPhoton = PhotonNetwork.connectedAndReady;
     AppendLog("Connected to Photon");
     PhotonPeer.RegisterType(typeof(BulletController.BulletInfo), (byte)'B', BulletController.BulletInfo.SerializeBulletInfo, BulletController.BulletInfo.DeserializeBulletInfo);
     PhotonPeer.RegisterType(typeof(BombController.BombInfo), (byte)'b', BombController.BombInfo.SerializeBombInfo, BombController.BombInfo.DeserializeBombInfo);
     PhotonPeer.RegisterType(typeof(ShipController.ShipTarget), (byte)'s', ShipController.ShipTarget.SerializeShipInfo, ShipController.ShipTarget.DeserializeShipInfo);
 }
Exemple #25
0
    // Start is called before the first frame update
    void Start()
    {
        Vector3 pos = new Vector3(UnityEngine.Random.Range(1, 15), UnityEngine.Random.Range(1, 5));

        PhotonNetwork.Instantiate(PlayerPrefab.name, pos, Quaternion.identity);
        PhotonPeer.RegisterType(typeof(Vector2Int), 242, SerializeVector2int, DeserializeVector2Int);
        PhotonPeer.RegisterType(typeof(SyncData), 243, SyncSerializer.Serialize, SyncSerializer.Deserialize);
    }
Exemple #26
0
    private void Awake()
    {
        Instance = this;

        photonView = PhotonView.Get(this);
        PhotonPeer.RegisterType(typeof(Analytics), (byte)'B', SerializedAnalytics.Serialize, SerializedAnalytics.Deserialize);
        InitMyAnalytics();
    }
 /// <summary>
 /// Tell Photon to use this instance as the serializer / deserializer, bumping off any previously-registered Registry
 /// </summary>
 public void installAsSerializer()
 {
     // TODO If there is a previously-registered registry, should we do something to it
     // to make it "disabled" so that accidentally using entities from it will throw an error?
     RegistryManager.registries[id] = new WeakReference <BaseRegistry>(this);
     // Tell photon that when it needs to serialize or deserialize type E, it should use our mechanism.
     PhotonPeer.RegisterType(typeof(E), 2, RegistryManager.SerializeEntityReference, RegistryManager.DeserializeEntityReference);
 }
Exemple #28
0
        public void BeginConnect()
        {
            PhotonPeer.RegisterType(typeof(Vector), (byte)Common.Protocol.CustomTypeCodes.Vector, Common.Protocol.SerializeVector, Common.Protocol.DeserializeVector);
            PhotonPeer.RegisterType(typeof(BoundingBox), (byte)Common.Protocol.CustomTypeCodes.BoundingBox, Common.Protocol.SerializeBoundingBox, Common.Protocol.DeserializeBoundingBox);

            this.peer.Connect(Settings.ServerAddress, Settings.ApplicationId);
            this.fiber.Enqueue(this.WaitForConnect);
        }
        /// <summary>
        /// Initializes this instance.
        /// </summary>
        public void Initialize()
        {
            ConnectionStatus = ConnectionStatus.Disconnected;
            PhotonPeer.RegisterType(typeof(Entry), new byte(), EntryToBytes, Entry.Deserialize);
            int rand = UnityEngine.Random.Range(0, int.MaxValue);

            PhotonNetwork.AuthValues = new AuthenticationValues(rand.ToString());
        }
Exemple #30
0
 public TypeRegistration()
 {
     PhotonPeer.RegisterType(
         typeof(SerializableVector2Int),
         SERIALIZABLE_VECTOR2INT_CODE,
         SerializableVector2Int.Serialize,
         SerializableVector2Int.Deserialize);
 }
Exemple #31
0
 // Use this for initialization
 void Start()
 {
     PhotonPeer = new PhotonPeer(this, ConnectionProtocol.Udp);
     if (!PhotonPeer.RegisterType(typeof(Vector3Net), (byte)200, Vector3Net.Serialize, Vector3Net.Deserialize))
     {
         throw new Exception("not working...");
     }
     Connect();
 }