Пример #1
0
    IEnumerator Start()
    {
        _instance = this;

        // create a sample store using the UserState class as a model for the state
        var userStore = new RuxStore <UserState>(UserState.GetDefaultState <UserState>(), new UserProvider());

        // create an instance of our Actions
        var userActions = new UserActions(userStore);

        yield return(new WaitForSeconds(1));

        // subscribe to state changes
        userStore.onStateChanged += (UserState obj) => {
            if (UITextBindings.ContainsKey("Text"))
            {
                UITextBindings["Text"].text = obj.ToString();
            }
            ;
            // Debug.Log("CALLBACK <color=green>" + obj.ToString() + "</color>");
        };


        // fire some actions!
        userActions.Login("adminwrong", "test");
        userActions.Login("adminwrong", "test123123");
        userActions.Login("admin", "test");
        userActions.Login("admin", "test");
    }