コード例 #1
0
ファイル: Enum.cs プロジェクト: yika-aixi/Effekseer
        public override void Update()
        {
            if (binding != null)
            {
                selectedValues = binding.GetValueAsInt();
            }
            else
            {
                selectedValues = -1;
            }

            var v = enums.Select((_, i) => Tuple.Create(_, i)).Where(_ => _.Item1 == selectedValues).FirstOrDefault();

            if (Manager.NativeManager.BeginCombo(id, FieldNames[v.Item2], swig.ComboFlags.None, icons[v.Item2]))
            {
                for (int i = 0; i < FieldNames.Count; i++)
                {
                    bool is_selected = (FieldNames[v.Item2] == FieldNames[i]);

                    if (Manager.NativeManager.Selectable(FieldNames[i], is_selected, swig.SelectableFlags.None, icons[i]))
                    {
                        selectedValues = enums[i];
                        binding.SetValue(selectedValues);
                    }

                    if (is_selected)
                    {
                        Manager.NativeManager.SetItemDefaultFocus();
                    }
                }

                Manager.NativeManager.EndCombo();
            }
        }
コード例 #2
0
        public void Update()
        {
            if (binding != null)
            {
                selectedValues = binding.GetValueAsInt();
            }
            else
            {
                selectedValues = -1;
            }

            var v = enums.Select((_, i) => Tuple.Create(_, i)).Where(_ => _.Item1 == selectedValues).FirstOrDefault();

            if (Manager.NativeManager.BeginCombo(Label + id, names[v.Item2], swig.ComboFlags.None))
            {
                for (int i = 0; i < names.Count; i++)
                {
                    bool is_selected = (names[v.Item2] == names[i]);
                    if (Manager.NativeManager.Selectable(names[i], is_selected))
                    {
                        selectedValues = enums[i];
                        binding.SetValue(selectedValues);
                    }

                    if (is_selected)
                    {
                        Manager.NativeManager.SetItemDefaultFocus();
                    }
                }

                Manager.NativeManager.EndCombo();
            }

            Console.WriteLine("Not implemented.");
        }
コード例 #3
0
ファイル: Enum.cs プロジェクト: chnghia/Effekseer
        public override void Update()
        {
            if (binding != null)
            {
                selectedValues = binding.GetValueAsInt();
            }
            else
            {
                selectedValues = -1;
            }

            if (EnableUndo)
            {
                valueChangingProp.Enable(binding);
            }

            var v = enums.Select((_, i) => Tuple.Create(_, i)).Where(_ => _.Item1 == selectedValues).FirstOrDefault();

            if (Manager.NativeManager.BeginCombo(InternalLabel + id, FieldNames[v.Item2].ToString(), swig.ComboFlags.None))
            {
                for (int i = 0; i < FieldNames.Count; i++)
                {
                    bool is_selected = (FieldNames[v.Item2] == FieldNames[i]);

                    if (Manager.NativeManager.Selectable(FieldNames[i].ToString(), is_selected, swig.SelectableFlags.None))
                    {
                        selectedValues = enums[i];

                        if (EnableUndo)
                        {
                            binding.SetValue(selectedValues);
                        }
                        else
                        {
                            binding.SetValueDirectly(selectedValues);
                        }
                    }

                    if (is_selected)
                    {
                        Manager.NativeManager.SetItemDefaultFocus();
                    }
                }

                Manager.NativeManager.EndCombo();
            }

            if (EnableUndo)
            {
                valueChangingProp.Disable();
            }
        }
コード例 #4
0
ファイル: Enum.cs プロジェクト: yika-aixi/Effekseer
 void Enum_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (binding != null)
     {
         Writing = true;
         if (SelectedIndex >= 0)
         {
             if (EnableUndo)
             {
                 binding.SetValue(enums[SelectedIndex]);
             }
             else
             {
                 binding.SetValueDirectly(enums[SelectedIndex]);
             }
         }
         Writing = false;
     }
 }