Exemplo n.º 1
0
 public State(Client client, UiBase view)
 {
     Client = client;
     Client.MessageHandler.OnMessage += HandleMessage;
     View = view;
     View.Initialise(client);
     IsFirstShow = true;
 }
Exemplo n.º 2
0
    public object GetBindWidget(UiBase uibase, Type t)
    {
        if (t.BaseType == typeof(Array))
        {
            return(GetBindComponents(uibase, t));
        }

        return(GetBindComponent(uibase, t));
    }
Exemplo n.º 3
0
        public DataViewParameter(BusinessObject businessObject, UiBase filter)
        {
            if (businessObject == null)
            {
                throw new ArgumentNullException("businessObject");
            }

            BusinessObject = businessObject;
            Filter         = filter;
        }
Exemplo n.º 4
0
    public object GetBindComponent(UiBase uibase, Type t, GameObject target = null)
    {
        GameObject go = target == null ? gameObject : target;

        if (t == typeof(GameObject))
        {
            return(go);
        }
        //if (typeof(ListitemHandler).IsAssignableFrom(t))
        //    return handler.CreateListitemHandler(t, go);
        return(go.GetComponent(t));
    }
Exemplo n.º 5
0
        public virtual void SetDataType(Type type, UiBase parent)
        {
            CloseCurrentService();

            CurrentType           = type;
            this.associatedParent = parent;

            if (type == typeof(UiClient))
            {
                UiClient.InitService();
                SelectService(UiClient.Service, typeof(UiClient), parent);
                return;
            }

            if (type == typeof(UiEmployee))
            {
                UiEmployee.InitService();
                SelectService(UiEmployee.Service, typeof(UiEmployee), parent);
                return;
            }

            if (type == typeof(UiProjectItemsCategory))
            {
                // only as DetailController
                UiProjectItemsCategory.InitService();
                SelectService(UiProjectItemsCategory.Service, typeof(UiProjectItemsCategory), parent);
                return;
            }

            if (type == typeof(UiProject))
            {
                UiProject.InitService();
                SelectService(UiProject.Service, typeof(UiProject), parent, new[] { "Budgets" });
                return;
            }

            if (type == typeof(UiMaterial))
            {
                UiMaterial.InitService();
                SelectService(UiMaterial.Service, typeof(UiMaterial), parent);
                return;
            }

            if (type == typeof(UiProjectCategory))
            {
                UiProjectCategory.InitService();
                SelectService(UiProjectCategory.Service, typeof(UiProjectCategory), parent);
                return;
            }

            // TODO : throw an exception
        }
Exemplo n.º 6
0
    void ChangeMenu(UiBase viewNext)
    {
        var animController = gameObject.GetOrAddComponent <UiAnimationController>();

        foreach (var view in views)
        {
            if (view != viewNext)
            {
                var temp = view;
                animController.AddAnim(new UiAnimationFade(view.gameObject, 0.2f, UiAnimationFade.FadeType.Out), false);
                animController.AddAction("", () => temp.Hide());
            }
        }

        animController.AddAnim(new UiAnimationFade(viewNext.gameObject, 0.2f, UiAnimationFade.FadeType.In), false);
        animController.AddAction("", () => viewNext.Show());

        animController.PlayAnimations();
    }
Exemplo n.º 7
0
    void ChangeMenu(UiBase viewNext)
    {
        var animController = gameObject.GetOrAddComponent<UiAnimationController>();

        foreach (var view in views)
        {
            if (view != viewNext)
            {
                var temp = view;
                animController.AddAnim(new UiAnimationFade(view.gameObject, 0.2f, UiAnimationFade.FadeType.Out), false);
                animController.AddAction("", () => temp.Hide());
            }
        }

        animController.AddAnim(new UiAnimationFade(viewNext.gameObject, 0.2f, UiAnimationFade.FadeType.In), false);
        animController.AddAction("", () => viewNext.Show());

        animController.PlayAnimations();
    }
Exemplo n.º 8
0
    public object GetBindComponents(UiBase uibase, Type t)
    {
        Type  type  = t.GetElementType();
        Array array = Array.CreateInstance(type, transform.childCount);

        Transform[] childs = new Transform[transform.childCount];

        for (int i = 0; i < transform.childCount; i++)
        {
            childs[i] = transform.GetChild(i);
        }

        for (int i = 0; i < childs.Length; ++i)
        {
            object o = GetBindComponent(uibase, type, childs[i].gameObject);
            array.SetValue(o, i);
        }

        return(array);
    }
Exemplo n.º 9
0
        private void SelectService(IDataClientService newService, Type dataType, UiBase parent, IEnumerable <string> reports = null)
        {
            // reset filter
            this.SearchValue = string.Empty;

            service = newService;
            service.UpdateStatus += service_UpdateStatus;
            //view.SetDetail(dataType);/* no need : detail items bound directly to grid's selection */
            dataSource = service.GetList(GetListParent());
            RefreshService(dataSource);
            RaisePropertyChanged("ForwardLinks");
            HasParent = parent != null;

            // TODO
            //if (reports != null)
            //    view.SetReports(reports);

            // TODO : remove temporary hack
            if (dataType == typeof(UiEmployee))
            {
                (dataSource as ObservableCollection <UiEmployee>)[1].IsLocked = true;
            }
        }
Exemplo n.º 10
0
        //void view_ForwardListSelected(object sender, EventArgs e) { SetDataType(sender as Type, service.SelectedItem as UiBase); }

        void view_MainGridSelectionChanged(object sender, UiBase e)
        {
            this.SelectionChanged(e);
        }
Exemplo n.º 11
0
 public void AddItem(UiBase newItem)
 {
     base.service.Update(newItem);
 }
Exemplo n.º 12
0
 public static void BindEvent(this GameObject obj, Action <PointerEventData> action,
                              Define.UiEvent type = Define.UiEvent.Click)
 {
     UiBase.BindEvent(obj, action, type);
 }