static public void OnAchievementSnapshotReady(AchievementsResult achievements, GetObjectAsyncOp <AchievementsResult> op)
    {
        achievsRead = false;
        //
        // We used the UI to take a snapshot, now we can do something with these achievements!
        if (!op.Success || achievements == null || achievements.Items == null)
        {
            DebugLog("\nAchievement snapshot failed HRESULT: 0x" + op.Result.ToString("X8"));
            //OnScreenLog.Add("Achievement snapshot failed HRESULT: 0x" + op.Result.ToString("X8"));
            if (SceneManager.GetActiveScene().buildIndex == 0)
            {
                achievsRead = true;
            }
            return;
        }

        StringBuilder sb = new StringBuilder();

        sb.Append("\nAchievements\n---------------------------\n\n");
        for (int i = 0; i < achievements.Items.Length; ++i)
        {
            var  a  = achievements.Items[i];
            bool ok = a.ProgressState == AchievementProgressState.Achieved;
            sb.Append(string.Format("[{0}] {1} - {2}\n", (ok ? "x" : "  "), a.Name.PadRight(20), (ok ? a.UnlockedDescription : a.LockedDescription)));
        }

        DebugLog("\n" + sb.ToString());
        //
        if (SceneManager.GetActiveScene().buildIndex == 0)
        {
            achievsRead = true;
        }
    }
Exemple #2
0
        public override Client  CreateClient(string address, int port)
        {
            if (this.clientAvailable != null)
            {
                Client tmp = this.clientAvailable;

                this.clientAvailable = null;
                return(tmp);
            }

            string outPath = Path.Combine(Environment.CurrentDirectory, "XboxOnePlayerBuild");

            Debug.Log("We're Box - Creating SecureTunnel to Server...");

            this.address = address;
            this.port    = port;

            if (!XBCopyFile(@"xt:\serverSDA.txt " + "\"" + outPath + @"\serverSDA.txt" + "\""))             // Copy over the machine's SDA
            {
                Debug.Log("Fetching SDA failed.");
                return(null);
            }


            try
            {
                string strServerSda = File.ReadAllText(outPath + @"\serverSDA.txt");

                Debug.Log("ServerSDA=" + strServerSda);

                SecureDeviceAddress serverSda = new SecureDeviceAddress(strServerSda);

                // Setup a Secure Tunnel for TCP
                Debug.Log("Initiating TcpC#Socket SecureTunnel connection...");
                TcpCsSocketSdaConnect = NetworkingManager.CreateSecureTunnelAsync("TcpCsSocketServer", serverSda);
                if (TcpCsSocketSdaConnect == null)
                {
                    Debug.Log("Error creating TCP connection to server (Connection initiation is null)");
                }
                else
                {
                    TcpCsSocketSdaConnect.Callback += this.CreatedTcpCsSocketSecureTunnelToServer;
                }

                Debug.Log("Waiting for an answer...");
            }
            catch (Exception ex)
            {
                Debug.Log("ERROR: Unable to create server SDA" + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace);
            }

            return(null);
        }
Exemple #3
0
 private void    CreatedTcpCsSocketSecureTunnelToServer(SecureTunnel st, GetObjectAsyncOp <SecureTunnel> op)
 {
     if (op.Success)
     {
         Debug.Log("CsSocketTcp Secure Tunnel to server created!");
         this.OurTcpCsSocketConnection = st;
         this.OurTcpCsSocketConnection.OnStateChanged += this.StateChanged;                 // Notify us if the state of this connection changes
         this.TcpCsSocketConnectToServer(st);
     }
     else
     {
         Debug.Log("CsSocketTcp Error creating Secure Tunnel to server: " + op.Result.ToString("X"));
     }
 }
Exemple #4
0
    static private void OnGetPresence(PresenceRecord result, GetObjectAsyncOp <PresenceRecord> op)
    {
        if (!op.Success)
        {
            //Debug.LogError("Failed to get presence string return code: [0x" + op.Result.ToString("X") + "] " + (op.Result == 0x80190190 ? "HTTP_STATUS_BAD_REQUEST: Bad request (400). The request could not be processed by the server due to invalid syntax." : ""));
            return;
        }
        // You will get multiple records back. The first record is usually the record associated with doing something in the HUD
        // and will have a presence string of ???.
        //Debug.LogError("Get Presence Returned Ok with " + result.PresenceTitleRecords.Length + " records.");
        StringBuilder sb = new StringBuilder();

        foreach (PresenceDeviceRecord rec in result.PresenceDeviceRecords)
        {
            sb.AppendFormat(" Presence:   {0}\n", rec.ToString());
            sb.AppendFormat(" TitleName:  {0}\n", rec.PresenceTitleRecords.ToString());
            sb.AppendFormat(" DeviceType: {0}\n", rec.DeviceType.ToString());
            sb.AppendFormat("\n");
        }
        //Debug.LogError(sb.ToString());
    }