예제 #1
0
            void Start()
            {
                PublisherState currentStep = PublisherUtils.GetCurrentPublisherState(PublisherWindow.FindInstance());

                Debug.Log(currentStep);
                switch (currentStep)
                {
                case PublisherState.Idle:
                    //your code here
                    break;

                case PublisherState.Login:
                    //your code here
                    break;

                case PublisherState.Zip:
                    //your code here
                    break;

                case PublisherState.Upload:
                    //your code here
                    break;

                case PublisherState.Process:
                    //your code here
                    break;

                default:
                    break;
                }
            }
예제 #2
0
 /// <summary>
 /// Initializes and returns an instance of AppState
 /// </summary>
 /// <param name="title"></param>
 /// <param name="buildOutputDir"></param>
 /// <param name="buildGUID"></param>
 /// <param name="zipPath"></param>
 /// <param name="step"></param>
 /// <param name="errorMsg"></param>
 /// <param name="key"></param>
 /// <param name="url"></param>
 public AppState(
     string title        = null, string buildOutputDir = null, string buildGUID = null, string zipPath = null,
     PublisherState step = default, string errorMsg    = null, string key       = null, string url     = null)
 {
     this.title          = title;
     this.buildOutputDir = buildOutputDir;
     this.buildGUID      = buildGUID;
     this.zipPath        = zipPath;
     this.step           = step;
     this.errorMsg       = errorMsg;
     this.url            = url;
     this.key            = key;
 }
예제 #3
0
        public void AddMultiLevelWildcard()
        {
            // Arrange
            var topicBuilder    = Fixture.Create <TopicBuilder>();
            var subscriberState = new PublisherState(topicBuilder);

            // Act
            Action addingMultiLevelWildcard = () =>
                                              subscriberState.AddMultiLevelWildcard();

            // Assert
            addingMultiLevelWildcard.Should()
            .Throw <IllegalStateOperationException>(
                "because adding a wildcard is not allowed when publishing");
        }
예제 #4
0
        public void AddSingleLevelWildcard()
        {
            // Arrange
            var topicBuilder    = Fixture.Create <TopicBuilder>();
            var subscriberState = new PublisherState(topicBuilder);

            // Act
            Action addingMultiLevelWildcard = () =>
                                              subscriberState.AddSingleLevelWildcard();

            // Assert
            addingMultiLevelWildcard.Should()
            .Throw <MqttBaseException>(
                "because adding a topic should not be allowed on subscribe");
        }
예제 #5
0
        public void AddTopic()
        {
            // Arrange
            var topicBuilder    = Fixture.Create <TopicBuilder>();
            var subscriberState = new PublisherState(topicBuilder);

            var topic = TestUtils.GenerateSingleValidTopic();

            // Act
            Action addingMultiLevelWildcard = () =>
                                              subscriberState.AddTopic(topic);

            // Assert
            addingMultiLevelWildcard.Should()
            .NotThrow <MqttBaseException>(
                "because adding a topic should be allowed on subscribe");
        }
예제 #6
0
 void Update()
 {
     if (IsWaitingForLocalizationToBeReady)
     {
         return;
     }
     if (currentState != Store.state.step)
     {
         string token = UnityConnectSession.instance.GetAccessToken();
         if (token.Length != 0)
         {
             currentState = Store.state.step;
             return;
         }
         Store.Dispatch(new NotLoginAction());
     }
     RebuildFrontend();
 }
예제 #7
0
        void SetupBackend()
        {
            AssemblyReloadEvents.beforeAssemblyReload += OnBeforeAssemblyReload;
            currentState = Store.state.step;
            CurrentTab   = string.Empty;
            previousTab  = string.Empty;
            UpdateWebGLInstalledFlag();

            tabFrontendSetupMethods = new Dictionary <string, Action>
            {
                { TabIntroduction, SetupIntroductionTab },
                { TabNotLoggedIn, SetupNotLoggedInTab },
                { TabInstallWebGL, SetupInstallWebGLTab },
                { TabNoBuild, SetupNoBuildTab },
                { TabSuccess, SetupSuccessTab },
                { TabError, SetupErrorTab },
                { TabUploading, SetupUploadingTab },
                { TabProcessing, SetupProcessingTab },
                { TabUpload, SetupUploadTab }
            };
        }
예제 #8
0
        public void Save()
        {
            bool needSave = false;

            if (SortMainId > 0)
            {
                var o = SortMainObject.GetSortMain(SortMainId);
                if (o != null)
                {
                    if (PublisherName?.Trim() != o.PublisherName)
                    {
                        o.PublisherName = PublisherName?.Trim();
                        needSave        = true;
                    }

                    if (PublisherCity?.Trim() != o.PublisherCity)
                    {
                        o.PublisherCity = PublisherCity?.Trim();
                        needSave        = true;
                    }

                    if (PublisherState?.Trim() != o.PublisherState)
                    {
                        o.PublisherState = PublisherState?.Trim();
                        needSave         = true;
                    }

                    if (PublisherCountry != o.PublisherCountry)
                    {
                        o.PublisherCountry = PublisherCountry;
                        needSave           = true;
                    }

                    if (needSave)
                    {
                        o.Save();
                    }
                }
            }
        }
예제 #9
0
        public void AddTopics()
        {
            // Arrange
            var topicBuilder    = Fixture.Create <TopicBuilder>();
            var subscriberState = new PublisherState(topicBuilder);

            var count  = Fixture.Create <int>() % Mqtt.Topic.MaximumAllowedLevels;
            var topics = new Queue <string>();

            for (var i = 0; i < count; ++i)
            {
                topics.Enqueue(TestUtils.GenerateSingleValidTopic());
            }

            // Act
            Action addingMultiLevelWildcard = () =>
                                              subscriberState.AddTopics(topics);

            // Assert
            addingMultiLevelWildcard.Should()
            .NotThrow <MqttBaseException>(
                "because adding a topic should be allowed on subscribe");
        }
예제 #10
0
        void RebuildFrontend()
        {
            if (!string.IsNullOrEmpty(Store.state.errorMsg))
            {
                LoadTab(TabError);
                return;
            }

            if (openedForTheFirstTime)
            {
                LoadTab(TabIntroduction);
                return;
            }

            if (currentState != Store.state.step)
            {
                currentState = Store.state.step;
            }

            bool loggedOut = (currentState == PublisherState.Login);

            if (loggedOut)
            {
                LoadTab(TabNotLoggedIn);
                return;
            }

            if (!webGLIsInstalled)
            {
                UpdateWebGLInstalledFlag();
                LoadTab(TabInstallWebGL);
                return;
            }

            if (!PublisherUtils.ValidBuildExists())
            {
                LoadTab(TabNoBuild);
                return;
            }

            if (!string.IsNullOrEmpty(Store.state.url))
            {
                LoadTab(TabSuccess);
                return;
            }


            if (currentState == PublisherState.Upload)
            {
                LoadTab(TabUploading);
                return;
            }

            if (currentState == PublisherState.Process)
            {
                LoadTab(TabProcessing);
                return;
            }

            LoadTab(TabUpload);
        }