Ejemplo n.º 1
0
        private static void DrawResourcesWarning(Rect position, SerializedProperty property, ref int line)
        {
            var subfolder = PhotonSyncManager.GetResourcesSubfolder(property.GetParent().GetType());

            if (property.IsInResourcesFolder(subfolder))
            {
                return;
            }

            EditorGUI.HelpBox(position.GetLines(line, 2), PhotonSync.WARNING_ASSET_NOT_IN_RESOURCES_FOLDER(subfolder), MessageType.Error);
            line += 2;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Sends an event with the given sync settings.
        /// </summary>
        /// <param name="settings">This defines sync settings</param>
        /// <param name="eventCode"></param>
        /// <param name="name">The name of the ScriptableObject. It is used to Load the Resource at the remote.</param>
        /// <param name="keyID">This is used to identify instanced Objects.</param>
        public static void SendEvent(PhotonSync settings, byte eventCode, string name, int keyID)
        {
            if (!settings.PUNSync || !PhotonNetwork.inRoom || settings.MuteNetworkBroadcasting)
            {
                return;
            }

            var raiseEventOptions = new RaiseEventOptions()
            {
                CachingOption = settings.cachingOptions,
                Receivers     = ReceiverGroup.Others
            };

            var content = new object[]
            {
                name,
                keyID,
            };

            PhotonNetwork.RaiseEvent(eventCode, content, true, raiseEventOptions);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Sends a parameter event with the given sync settings.
        /// </summary>
        /// <param name="settings"></param>
        /// <param name="name"></param>
        /// <param name="keyID"></param>
        /// <param name="parameter"></param>
        /// <typeparam name="T"></typeparam>
        public static void SendEventParam <T>(PhotonSync settings, string name, int keyID, T parameter)
        {
            if (!settings.PUNSync || !PhotonNetwork.inRoom || settings.MuteNetworkBroadcasting)
            {
                return;
            }

            var raiseEventOptions = new RaiseEventOptions()
            {
                CachingOption = settings.cachingOptions,
                Receivers     = ReceiverGroup.Others
            };

            var content = new object[]
            {
                name,
                keyID,
                parameter
            };

            PhotonNetwork.RaiseEvent(TypeToCode(typeof(T)), content, true, raiseEventOptions);
        }