Example #1
0
        private static void PumpMessages()
        {
            while (Messages.HasMessage())
            {
                Messages.PluginMessage msg = default(Messages.PluginMessage);
                Messages.GetFirstMessage(out msg);
                System.ProcessMessage(msg);
                User.ProcessMessage(msg);
                Friends.ProcessMessage(msg);
                Trophies.ProcessMessage(msg);
                Ranking.ProcessMessage(msg);
                Matching.ProcessMessage(msg);
                Messaging.ProcessMessage(msg);
                WordFilter.ProcessMessage(msg);
                Commerce.ProcessMessage(msg);
                Ticketing.ProcessMessage(msg);
                TusTss.ProcessMessage(msg);
                Dialogs.ProcessMessage(msg);
                Facebook.ProcessMessage(msg);
                Twitter.ProcessMessage(msg);
                Requests.ProcessMessage(msg);
                switch (msg.type)
                {
                case Messages.MessageType.kNPToolKit_Log:
                    if (Main.OnLog != null)
                    {
                        Main.OnLog(msg);
                    }
                    break;

                case Messages.MessageType.kNPToolKit_LogWarning:
                    if (Main.OnLogWarning != null)
                    {
                        Main.OnLogWarning(msg);
                    }
                    break;

                case Messages.MessageType.kNPToolKit_LogError:
                    if (Main.OnLogError != null)
                    {
                        Main.OnLogError(msg);
                    }
                    break;

                case Messages.MessageType.kNPToolKit_NPInitialized:
                    if (Main.OnNPInitialized != null)
                    {
                        Main.OnNPInitialized(msg);
                    }
                    break;
                }
                Messages.RemoveFirstMessage();
            }
        }
Example #2
0
        public static bool ProcessMessage(Messages.PluginMessage msg)
        {
            switch (msg.type)
            {
            case Messages.MessageType.kNPToolKit_CommerceSessionCreated:
                if (Commerce.OnSessionCreated != null)
                {
                    Commerce.OnSessionCreated(msg);
                }
                return(true);

            case Messages.MessageType.kNPToolKit_CommerceSessionAborted:
                if (Commerce.OnSessionAborted != null)
                {
                    Commerce.OnSessionAborted(msg);
                }
                return(true);

            case Messages.MessageType.kNPToolKit_CommerceGotCategoryInfo:
                if (Commerce.OnGotCategoryInfo != null)
                {
                    Commerce.OnGotCategoryInfo(msg);
                }
                return(true);

            case Messages.MessageType.kNPToolKit_CommerceGotProductList:
                if (Commerce.OnGotProductList != null)
                {
                    Commerce.OnGotProductList(msg);
                }
                return(true);

            case Messages.MessageType.kNPToolKit_CommerceGotProductInfo:
                if (Commerce.OnGotProductInfo != null)
                {
                    Commerce.OnGotProductInfo(msg);
                }
                return(true);

            case Messages.MessageType.kNPToolKit_CommerceGotEntitlementList:
                if (Commerce.OnGotEntitlementList != null)
                {
                    Commerce.OnGotEntitlementList(msg);
                }
                return(true);

            case Messages.MessageType.kNPToolKit_CommerceConsumedEntitlement:
                if (Commerce.OnConsumedEntitlement != null)
                {
                    Commerce.OnConsumedEntitlement(msg);
                }
                return(true);

            case Messages.MessageType.kNPToolKit_CommerceError:
                if (Commerce.OnError != null)
                {
                    Commerce.OnError(msg);
                }
                return(true);

            case Messages.MessageType.kNPToolKit_CommerceCheckoutStarted:
                if (Commerce.OnCheckoutStarted != null)
                {
                    Commerce.OnCheckoutStarted(msg);
                }
                return(true);

            case Messages.MessageType.kNPToolKit_CommerceCheckoutFinished:
                if (Commerce.OnCheckoutFinished != null)
                {
                    Commerce.OnCheckoutFinished(msg);
                }
                return(true);

            case Messages.MessageType.kNPToolKit_CommerceProductBrowseStarted:
                if (Commerce.OnProductBrowseStarted != null)
                {
                    Commerce.OnProductBrowseStarted(msg);
                }
                return(true);

            case Messages.MessageType.kNPToolKit_CommerceProductBrowseSuccess:
                if (Commerce.OnProductBrowseSuccess != null)
                {
                    Commerce.OnProductBrowseSuccess(msg);
                }
                return(true);

            case Messages.MessageType.kNPToolKit_CommerceProductBrowseAborted:
                if (Commerce.OnProductBrowseAborted != null)
                {
                    Commerce.OnProductBrowseAborted(msg);
                }
                return(true);

            case Messages.MessageType.kNPToolKit_CommerceProductBrowseFinished:
                if (Commerce.OnProductBrowseFinished != null)
                {
                    Commerce.OnProductBrowseFinished(msg);
                }
                return(true);

            case Messages.MessageType.kNPToolKit_CommerceCategoryBrowseStarted:
                if (Commerce.OnProductCategoryBrowseStarted != null)
                {
                    Commerce.OnProductCategoryBrowseStarted(msg);
                }
                return(true);

            case Messages.MessageType.kNPToolKit_CommerceCategoryBrowseFinished:
                if (Commerce.OnProductCategoryBrowseFinished != null)
                {
                    Commerce.OnProductCategoryBrowseFinished(msg);
                }
                return(true);

            case Messages.MessageType.kNPToolKit_CommerceVoucherInputStarted:
                if (Commerce.OnProductVoucherInputStarted != null)
                {
                    Commerce.OnProductVoucherInputStarted(msg);
                }
                return(true);

            case Messages.MessageType.kNPToolKit_CommerceVoucherInputFinished:
                if (Commerce.OnProductVoucherInputFinished != null)
                {
                    Commerce.OnProductVoucherInputFinished(msg);
                }
                return(true);

            case Messages.MessageType.kNPToolKit_CommerceDownloadListStarted:
                if (Commerce.OnDownloadListStarted != null)
                {
                    Commerce.OnDownloadListStarted(msg);
                }
                return(true);

            case Messages.MessageType.kNPToolKit_CommerceDownloadListFinished:
                if (Commerce.OnDownloadListFinished != null)
                {
                    Commerce.OnDownloadListFinished(msg);
                }
                return(true);

            default:
                return(false);
            }
        }