Пример #1
0
        static ERPC()
        {
            projectName = Application.productName;
            sceneName   = SceneManager.GetActiveScene().name;

            EditorApplication.update += Update;

            start = GetTimeStamp();

            if (!EditorApplication.isPlaying)
            {
                CreateClient();
            }
            ERPCSettings.GetSettings();
            if (enableOnStartup)
            {
                enabled = true;
            }
            ;
        }
Пример #2
0
        public static void Initialize()
        {
            Debug.Log("[ERP] Creating Client");

            //Prepare the logger
            DiscordRPC.Logging.ILogger logger = null;

            //Update the logger to the unity logger
            if (Debug.isDebugBuild)
            {
                logger = new FileLogger("discordrpc.log")
                {
                    Level = logLevel
                }
            }
            ;
            if (Application.isEditor)
            {
                logger = new UnityLogger()
                {
                    Level = logLevel
                }
            }
            ;

            client = new DiscordRpcClient(
                applicationID,                                  //The Discord Application ID
                pipe: (int)targetPipe,                          //The target pipe to connect too
                                                                // logger: logger,                              //The logger. Will Uncomment after when Lachee fixes issue #136 in Lachee/discord-rpc-csharp
                autoEvents: false,                              //WE will manually invoke events
                client: new UnityNamedPipe()                    //The client for the pipe to use. Unity MUST use a NativeNamedPipeClient since its managed client is broken.
                );

            Debug.Log("[ERP] Initialize");

            client.Initialize();                                //Connects the client

            ERPCSettings.GetSettings();
            UpdateActivity();
        }