Beispiel #1
0
        // Use this for initialization
        IEnumerator Start()
        {
            // Grab the web checker
            WebLocationChecker webChecker = null;

            if (Singleton.Instance.IsWebplayer == true)
            {
                webChecker = Singleton.Get <WebLocationChecker>();
            }

            // Grab information about webChecker
            if (webChecker != null)
            {
                // Print that we're loading
                infoLabel.text = LoadingMessage;

                // Wait until the WebLocationChecker is done
                while (webChecker.CurrentState == WebLocationChecker.State.InProgress)
                {
                    yield return(null);
                }

                // Update the reason for this dialog to appear
                infoLabel.text = Utility.BuildTestMessage(new StringBuilder(), webChecker);
            }
            else
            {
                infoLabel.text = ForWebGlMessage;
            }
        }
Beispiel #2
0
        public void UpdateReason(Reason reason)
        {
            // Grab the web checker
            WebLocationChecker webChecker = null;

            if (Singleton.Instance.IsWebplayer == true)
            {
                webChecker = Singleton.Get <WebLocationChecker>();
            }

            // Update the reason for this dialog to appear
            switch (reason)
            {
            case Reason.CannotConfirmDomain:
                // Update translation key
                reasonMessage.TranslationKey = cannotConfirmDomainMessageTranslationKey;
                break;

            case Reason.IsIncorrectDomain:
                if (webChecker != null)
                {
                    // Setup translation key, with proper population of fields
                    reasonMessage.SetTranslationKey(domainDoesNotMatchMessageTranslationKey, webChecker.RetrievedHostName);
                }
                else
                {
                    // Update translation key
                    reasonMessage.TranslationKey = gameIsNotGenuineMessageTranslationKey;
                }
                break;

            case Reason.JustTesting:
                // Overwrite the text: it's a test
                StringBuilder builder = new StringBuilder();
                builder.Append("This menu is just a test. ");
                Utility.BuildTestMessage(builder, webChecker);
                reasonMessage.CurrentText = builder.ToString();
                break;

            default:
                // Update translation key
                reasonMessage.TranslationKey = gameIsNotGenuineMessageTranslationKey;
                break;
            }
        }
        public void UpdateReason(Reason reason)
        {
            // Grab the web checker
            WebLocationChecker webChecker = null;

            if (Singleton.Instance.IsWebplayer == true)
            {
                webChecker = Singleton.Get <WebLocationChecker>();
            }

            // Update the reason for this dialog to appear
            StringBuilder builder = new StringBuilder();

            switch (reason)
            {
            case Reason.CannotConfirmDomain:
                builder.Append(cannotConfirmDomainMessage);
                break;

            case Reason.IsIncorrectDomain:
                if (webChecker != null)
                {
                    builder.AppendFormat(domainDoesNotMatchMessage, webChecker.RetrievedHostName);
                }
                else
                {
                    builder.Append(gameIsNotGenuineMessage);
                }
                break;

            case Reason.JustTesting:
                builder.Append("This menu is just a test. ");
                Utility.BuildTestMessage(builder, webChecker);
                break;

            default:
                builder.Append(gameIsNotGenuineMessage);
                break;
            }
            reasonMessage.text = builder.ToString();
        }
Beispiel #4
0
        IEnumerator VerifyBuild()
        {
            if (Singleton.Instance.IsWebplayer == true)
            {
                // Grab the web checker
                WebLocationChecker webChecker = Singleton.Get <WebLocationChecker>();
                if (webChecker != null)
                {
                    // Wait until the webchecker is done
                    while (webChecker.CurrentState == WebLocationChecker.State.InProgress)
                    {
                        yield return(null);
                    }

                    // Check the state
                    switch (webChecker.CurrentState)
                    {
                    case WebLocationChecker.State.EncounteredError:
                        buildState = MalformedGameMenu.Reason.CannotConfirmDomain;
                        break;

                    case WebLocationChecker.State.DomainDidntMatch:
                        buildState = MalformedGameMenu.Reason.IsIncorrectDomain;
                        break;
                    }
                }
            }
            else if ((Application.genuineCheckAvailable == true) && (Application.genuine == false))
            {
                buildState = MalformedGameMenu.Reason.IsNotGenuine;
            }

            // Check if we're simulating failure
            if (Singleton.Instance.IsSimulatingMalformedGame == true)
            {
                // Indicate as such
                buildState = MalformedGameMenu.Reason.JustTesting;
            }
        }
        public static string BuildTestMessage(StringBuilder builder, WebLocationChecker webChecker)
        {
            builder.AppendLine("Information according to the WebLocationChecker:");

            // Indicate the object's state
            int bulletNumber = 1;

            builder.Append(bulletNumber);
            builder.AppendLine(") the WebLocationChecker state is:");
            builder.AppendLine(webChecker.CurrentState.ToString());

            // Indicate the current domain information
            ++bulletNumber;
            builder.Append(bulletNumber);
            builder.AppendLine(") this game's domain is:");
            builder.AppendLine(webChecker.RetrievedHostName);

            // List entries from the default domain list
            ++bulletNumber;
            builder.Append(bulletNumber);
            builder.AppendLine(") the default domain list is:");
            int index = 0;

            for (; index < webChecker.DefaultDomainList.Length; ++index)
            {
                builder.Append("- ");
                builder.AppendLine(webChecker.DefaultDomainList[index]);
            }

            // Check if there's a download URL to list
            if (string.IsNullOrEmpty(webChecker.DownloadDomainsUrl) == false)
            {
                // Print that URL
                ++bulletNumber;
                builder.Append(bulletNumber);
                builder.AppendLine(") downloaded a list of domains from:");
                builder.AppendLine(webChecker.DownloadDomainsUrl);

                // Check if there are any downloaded domains
                if (webChecker.DownloadedDomainList != null)
                {
                    ++bulletNumber;
                    builder.Append(bulletNumber);
                    builder.AppendLine(") downloaded the following domains:");
                    for (index = 0; index < webChecker.DownloadedDomainList.Length; ++index)
                    {
                        builder.Append("- ");
                        builder.AppendLine(webChecker.DownloadedDomainList[index]);
                    }
                }
                else
                {
                    ++bulletNumber;
                    builder.Append(bulletNumber);
                    builder.AppendLine(") downloading that list failed, however.");
                }
            }

            // Show unique list of domains
            ++bulletNumber;
            builder.Append(bulletNumber);
            builder.AppendLine(") together, the full domain list is as follows:");
            foreach (string domain in webChecker.AllUniqueDomains.Keys)
            {
                builder.Append("- ");
                builder.AppendLine(domain);
            }

            // Return URL
            return(builder.ToString());
        }