예제 #1
0
        public ComplectsViewModel(IUnityContainer container) : base(container)
        {
            var complectsParameter = GlobalAppProperties.Actual.ComplectsParameter;
            var complects          = UnitOfWork.Repository <Product>().Find(x => x.ProductBlock.Parameters.ContainsById(complectsParameter)).Select(x => new Complect(x));

            Items = new ObservableCollection <Complect>(complects);

            SelectCommand = new DelegateCommand(
                () =>
            {
                IsSelected = true;
                SelectEvent?.Invoke();
            },
                () => SelectedItem != null);

            NewComplectCommand = new DelegateCommand(
                () =>
            {
                var complectViewModel = Container.Resolve <ComplectViewModel>();
                complectViewModel.ShowDialog();
                if (complectViewModel.IsSaved)
                {
                    var complect = new Complect(complectViewModel.Product.Model);
                    Items.Add(complect);
                    SelectedItem = complect;
                }
            });
        }
 public void Select()
 {
     if (SelectEvent != null)
     {
         SelectEvent.Invoke();
     }
 }
예제 #3
0
    void SelectionChanged()
    {
        int selected = Options[SelectedIndex];

        onSelect.Invoke(selected);
        Label.GetComponent <Text>().text = selected.ToString();
    }
예제 #4
0
        private void ValueText_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (IsLoadCmp)
            {
                uint v;

                if (uint.TryParse(ValueText.Text, out v))
                {
                    CurrentArg.VALUE  = v;
                    CurrentArg.IsInit = false;
                    SelectEvent.Invoke(sender, e);
                }
                else
                {
                    try
                    {
                        v = Convert.ToUInt32(ValueText.Text, 16);

                        CurrentArg.VALUE  = v;
                        CurrentArg.IsInit = false;
                        SelectEvent.Invoke(sender, e);
                    }
                    catch (Exception)
                    {
                    }
                }
            }
        }
예제 #5
0
        public ComplectTypesViewModel(IEnumerable <Parameter> items, IUnitOfWork unitOfWork)
        {
            _unitOfWork = unitOfWork;
            Items       = new ObservableCollection <Parameter>(items);

            SelectCommand = new DelegateCommand(
                () =>
            {
                IsSelected = true;
                SelectEvent?.Invoke();
            },
                () => SelectedItem != null);

            NewTypeCommand = new DelegateCommand(
                () =>
            {
                var complectTypeWindow = new ComplectTypeWindow(_unitOfWork.Repository <ParameterGroup>().GetById(GlobalAppProperties.Actual.ComplectsGroup.Id));
                complectTypeWindow.ShowDialog();
                if (complectTypeWindow.IsOk)
                {
                    complectTypeWindow.ParameterComplectType.AcceptChanges();
                    var parameter = complectTypeWindow.ParameterComplectType.Model;
                    var relation  = new ParameterRelation();
                    relation.RequiredParameters.Add(_unitOfWork.Repository <Parameter>().GetById(GlobalAppProperties.Actual.ComplectsParameter.Id));
                    parameter.ParameterRelations.Add(relation);
                    relation.ParameterId = parameter.Id;

                    Items.Add(parameter);
                    SelectedItem = parameter;
                }
            });
        }
예제 #6
0
 private void StringText_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (IsLoadCmp)
     {
         CurrentArg.STRING.String = StringText.Text;
         CurrentArg.IsInit        = false;
         SelectEvent.Invoke(sender, e);
     }
 }
예제 #7
0
    /// <summary> Called when the first card is select. Call in MemoryGameManager.cs </summary>
    public void SelectCard()
    {
        // Calls the select event.
        if (SelectEvent != null)
        {
            SelectEvent.Invoke();
        }

        isSelected = true;
    }
예제 #8
0
 private void AllCheckBox_Checked(object sender, RoutedEventArgs e)
 {
     if (IsLoadCmp)
     {
         CurrentArg.VALUE    = 0;
         CurrentArg.IsInit   = false;
         ValueText.IsEnabled = false;
         SelectEvent.Invoke(sender, e);
     }
 }
예제 #9
0
        private void OnSelectButtonPressed()
        {
            if (!playerSkinConfig.IsUnlocked)
            {
                return;
            }

            SelectEvent?.Invoke(this);
            selectedImage.gameObject.SetActive(true);
        }
예제 #10
0
 void Update()
 {
     if (player != null && player.GetButtonDown("JUMP"))
     {
         selectedIndex = viewedIndex;
         if (selectedFeedback != null)
         {
             selectedFeedback.SetActive(true);
         }
         selectEvent.Invoke(playerId, viewedIndex);
     }
 }
예제 #11
0
 private void Click(string name = "")
 {
     if (name == "")
     {
         var clickedButton = UnityEngine.EventSystems.EventSystem.current.currentSelectedGameObject;
         name = clickedButton.name;
     }
     if (SelectEvent != null)
     {
         SelectEvent.Invoke(this, name);
     }
 }
예제 #12
0
 private void Activate()
 {
     Debug.Log("process toggle aaa");
     Init();
     if (_toggle.isOn)
     {
         SelectEvent.Invoke(this);
     }
     else
     {
         DeselectEvent.Invoke(this);
     }
 }
 public void OnPointerClick(PointerEventData eventData)
 {
     if (_hasFirstClick && (_lastClickTime + _clicksInterval) > Time.time)
     {
         _selected      = true;
         _hasFirstClick = false;
         SelectEvent.Invoke(this);
     }
     else
     {
         _hasFirstClick = true;
     }
     _lastClickTime = Time.time;
 }
예제 #14
0
 //マッチングするルーム列取得時の処理
 public void SetMatchList(List <MatchInfoSnapshot> matchList)
 {
     for (var i = 0; i < menuRoomItemButton.parent.childCount; ++i)
     {
         var c = menuRoomItemButton.parent.GetChild(i);
         if (c != menuRoomItemButton)
         {
             Destroy(c.gameObject);
         }
     }
     foreach (var m in matchList)
     {
         var label = string.Format("{0} / {1}", m.name, m.hostNodeId.ToString(), m.networkId);
         var bobj  = Instantiate(menuRoomItemButton, menuRoomItemButton.parent) as Transform;
         bobj.GetComponentInChildren <Text>().text = label;
         var arg = m; // local 変数にしておかないと次のlambda funcでうまくclosure化されない
         bobj.GetComponent <Button>().onClick.AddListener(() => onSelect.Invoke(arg));
         bobj.gameObject.SetActive(true);
     }
     menuRoomWaitingIcon.SetActive(false);
 }
예제 #15
0
        private void ChangeDelayTimerTick(object sender, EventArgs e)
        {
            this.changeDelayTimer.Enabled = false;
            this.changeDelayTimer.Dispose();
            this.changeDelayTimer = null;

            int c = this.SelectedItems.Count;

            if (c > 0)
            {
                if (SelectEvent != null)
                {
                    string[] values = new string[c];
                    for (int i = 0; i < c; i++)
                    {
                        values[i] = this.SelectedItems[i].Text;
                    }
                    SelectEvent.Invoke((int)this.Tag, values);
                }
            }
        }
예제 #16
0
    void Update()
    {
#if UNITY_EDITOR
        if (Input.GetMouseButtonDown(0))
        {
            screenPos = Input.mousePosition;
#else
        if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)
        {
            Debug.Log("touch happened");
            screenPos = Input.GetTouch(0).position;
#endif
            IInteractable newSelected = null;
            IInteractable oldSelected = selected;

            RaycastHit hit;
            // pointerData.position = screenPos;
            // List<RaycastResult> results = new List<RaycastResult>();
            // eventSys.RaycastAll(pointerData, results);
            // if (results.Count > 0)
            // {
            //     newSelected = results[0].gameObject.GetComponent<IInteractable>();
            //     newSelected?.Select();
            //     return;
            // }
            if (Physics.Raycast(cam.ScreenPointToRay(screenPos), out hit))
            // else if (Physics.Raycast(cam.ScreenPointToRay(screenPos), out hit))
            {
                newSelected = hit.transform.GetComponent <IInteractable>();
            }

            Deselect();
            if (newSelected != null && newSelected != oldSelected)
            {
                selected = newSelected;
                newSelected?.Select();
                SelectEvent?.Invoke();
            }
        }
    }
 /// <summary>
 /// 添加完后修改颜色
 /// </summary>
 /// <param name="index"></param>
 /// <param name="item"></param>
 protected override void InsertItem(int index, TableCell item)
 {
     base.InsertItem(index, item);
     item.Image.color = item.SelectColor;
     if (item.Data.ColumnMerge > 0 || item.Data.RowMerge > 0)
     {
         var cells = item.Data.TableController.Data.CellDatas.Where(p =>
                                                                    p.ColumnIndex > item.Data.ColumnIndex && p.ColumnIndex <= item.Data.ColumnIndex + item.Data.ColumnMerge
                                                                    &&
                                                                    p.RowIndex > item.Data.RowIndex && p.RowIndex <= item.Data.RowIndex + item.Data.RowMerge
                                                                    );
         foreach (var cell in cells)
         {
             if (item != cell.TableCell)
             {
                 Add(cell.TableCell);
             }
         }
     }
     if (SelectEvent != null)
     {
         SelectEvent.Invoke(item);
     }
 }
예제 #18
0
 /// <summary>
 /// Raises the deselect event.
 /// </summary>
 /// <param name="eventData">Event data.</param>
 public void OnDeselect(BaseEventData eventData)
 {
     onDeselect.Invoke(eventData);
 }
예제 #19
0
 public override void OnPointerExit(PointerEventData eventData)
 {
     onPointerExit.Invoke();
     base.OnPointerExit(eventData);
 }
예제 #20
0
 public override void OnDeselect(BaseEventData eventData)
 {
     onDeselect.Invoke();
     base.OnDeselect(eventData);
 }
예제 #21
0
 private void ExcecuteSelect(Command.CommandSelect command)
 {
     SelectEvent?.Invoke(command);
 }
        /// <summary>
        /// Submits the result.
        /// </summary>
        /// <param name="eventData">Event data.</param>
        /// <param name="isEnter">Is Enter pressed?</param>
        protected virtual void SubmitResult(BaseEventData eventData, bool isEnter)
        {
            if (DisplayListView.SelectedIndex == -1)
            {
                return;
            }

            if (InputFieldProxy.IsMultiLineNewline())
            {
                if (!DisplayListView.gameObject.activeInHierarchy)
                {
                    return;
                }
                else
                {
                    isEnter = false;
                }
            }

            var item = DisplayListView.DataSource[DisplayListView.SelectedIndex];

            if (TargetListView != null)
            {
                TargetListView.Init();
                TargetListView.Set(item, AllowDuplicate);
            }

            var value = GetStringValue(item);

            if (Result == AutocompleteResult.Append)
            {
                int end_position   = (DisplayListView.gameObject.activeInHierarchy && eventData != null && !isEnter) ? InputFieldProxy.caretPosition : CaretPosition;
                var text           = InputFieldProxy.text.Substring(0, end_position);
                var start_position = text.LastIndexOfAny(DelimiterChars) + 1;

                InputFieldProxy.text = InputFieldProxy.text.Substring(0, start_position) + value + InputFieldProxy.text.Substring(end_position);

                InputFieldProxy.caretPosition = start_position + value.Length;
                                #if UNITY_5_1 || UNITY_5_2 || UNITY_5_3 || UNITY_5_3_OR_NEWER
                // InputField.selectionFocusPosition = start_position + value.Length;
                                #else
                InputFieldProxy.MoveToEnd();
                                #endif
                if (isEnter)
                {
                    FixCaretPosition = start_position + value.Length;
                    InputFieldProxy.ActivateInputField();
                }
            }
            else
            {
                InputFieldProxy.text = value;
                                #if UNITY_5_1 || UNITY_5_2 || UNITY_5_3 || UNITY_5_3_OR_NEWER
                InputFieldProxy.caretPosition = value.Length;
                                #else
                InputFieldProxy.ActivateInputField();
                                #endif
                FixCaretPosition = value.Length;
            }

            OnOptionSelected.Invoke();
            OnOptionSelectedItem.Invoke(item);

            HideOptions();
        }
 public override void OnSelect(BaseEventData eventData)
 {
     base.OnSelect(eventData);
     onSelect?.Invoke(this, true);
 }
예제 #24
0
 public override void OnSelect(BaseEventData eventData)
 {
     SelectEvent.Invoke();
 }
예제 #25
0
 public void OnSelect(BaseEventData eventData)
 {
     _selected = true;
     SelectEvent.Invoke(this);
 }