示例#1
0
        private void SetupBindings()
        {
            var set = this.CreateBindingSet <ChatView, ChatViewModel>();

            set.Bind(_source).To(vm => vm.Conversations);
            set.Bind(_createButton).To(vm => vm.CreateChatCommand);
            set.Bind(_refreshControl).For(r => r.RefreshCommand).To(vm => vm.RefreshCommand);
            set.Bind(_refreshControl).For(r => r.IsRefreshing).To(vm => vm.IsRefreshing);
            set.Apply();
            ConversationTable.ReloadData();
        }
示例#2
0
        private void SetupTable()
        {
            _source = new GenericTableviewSourceWithHeight <ConversationListViewModel>(ConversationTable)
            {
                GetIdentifierFunc = (model, path) => ChatCell.Identifier,
                RowSelectionFunc  = (view, path, item) => ViewModel.ConversationSelected(item),
                ModifyCellFunc    = (cell, indexPath, item) =>
                {
                    var chatCell = cell as ChatCell;

                    if (chatCell != null)
                    {
                        chatCell.SetRulerFullWidth(indexPath.Row == 0);

                        if (indexPath.Section + 1 == ConversationTable.NumberOfSections() &&
                            ConversationTable.NumberOfRowsInSection(indexPath.Section) == indexPath.Row + 1)
                        {
                            // Show bottom border on last cell
                            chatCell.SetBottomRulerVisible(true);
                        }
                        else
                        {
                            chatCell.SetBottomRulerVisible(false);
                        }
                    }
                },
                GetCellHeightFunc = (view, path, item) =>
                {
                    return(73);
                },
                GetEstimatedHeightFunc = (view, path, item) =>
                {
                    return(73);
                },
                AutoDeselect     = true,
                UseAnimations    = true,
                AddAnimation     = UITableViewRowAnimation.Top,
                RemoveAnimation  = UITableViewRowAnimation.Bottom,
                ReplaceAnimation = UITableViewRowAnimation.Middle,
            };

            ConversationTable.Source = _source;

            ConversationTable.ContentInset = new UIEdgeInsets(5, 0, 0, 0);

            _refreshControl = new MvxUIRefreshControl();

            ConversationTable.AddSubviews(_refreshControl);
        }
        public override void OnInspectorGUI()
        {
            // Update the serializedProperty - always do this in the beginning of OnInspectorGUI.
            serializedObject.Update();

            // TODO: Draw UI here
            //EditorGUILayout.PropertyField();
            DrawDefaultInspector();

            Dialog diag = (Dialog)target;

            if (EditorApplication.isPlaying)
            {
                if (!diag.IsPlaying() && GUILayout.Button("Play"))
                {
                    diag.StartDialog();
                }
            }

            ConversationTable table = diag.GetComponent <ConversationTable>();

            if (diag.Track == null && table != null && table.m_speakerMonologue != null)
            {
                if (GUILayout.Button("Port from Conversation"))
                {
                    SpeakerTrack track = new SpeakerTrack();
                    track.name              = table.m_speakerMonologue.name;
                    track.DialogClip        = table.m_speakerMonologue;
                    track.ParticipantNumber = (uint)diag.Participants.Length;
                    diag.Track              = track;
                    AssetDatabase.CreateAsset(track, "Assets/" + track.name + ".asset");
                }
            }

            if (GUILayout.Button("Auto-Feed Participants from Children"))
            {
                diag.Participants = diag.GetComponentsInChildren <DialogParticipant>();
            }


            // Apply changes to the serializedProperty - always do this in the end of OnInspectorGUI.
            serializedObject.ApplyModifiedProperties();
        }