예제 #1
0
        public SingleSelectorEditorForm(SelectorTypes selectorType, int[] ids)
        {
            InitializeComponent();
            if (ids == null || ids.Length == 0)
            {
                return;
            }
            _repWkr = RepositoryWorker.Instance();
            ItemSelector item;

            flp_items.Controls.Clear();
            switch (selectorType)
            {
            case SelectorTypes.ActionsCustom:
                for (int i = 0; i < ids.Length; i++)
                {
                    var act = _repWkr.GetAction(ids[i]);
                    item        = new ItemSelector(act.Id, act.Icon, act.Name);
                    item.Click += Item_Click;
                    flp_items.Controls.Add(item);
                }
                break;

            default:
                break;
            }
            item = null;
        }
예제 #2
0
        private void btnSelect_Click(object sender, EventArgs e)
        {
            DbBrowser db = new DbBrowser();

            using (ItemSelector poetSeletor = new ItemSelector("انتخاب شاعر", db.Poets.ToArray(), null))
            {
                if (poetSeletor.ShowDialog(this) == DialogResult.OK)
                {
                    GanjoorPoet poet = poetSeletor.SelectedItem as GanjoorPoet;
                    PoetId = poet._ID;
                    txtSelectedPoetOrCategory.Text = poet._Name;
                    if (MessageBox.Show(
                            $"آیا تمایل دارید خوانش‌های بخش خاصی از آثار {poet._Name} را دریافت کنید؟",
                            "تأییدیه", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2,
                            MessageBoxOptions.RtlReading | MessageBoxOptions.RightAlign) == System.Windows.Forms.DialogResult.No)
                    {
                        db.CloseDb();

                        return;
                    }
                    using (CategorySelector catSelector = new CategorySelector(poet._ID, db))
                    {
                        if (catSelector.ShowDialog(this) == DialogResult.OK)
                        {
                            CatId = catSelector.SelectedCatID;
                            txtSelectedPoetOrCategory.Text = $"{poet._Name} » {db.GetCategory(CatId)._Text}";
                            db.CloseDb();
                        }
                    }
                }
            }
        }
예제 #3
0
        public void addItemSelector(string displayText)
        {
            // add a new item selector
            // determine new index for item
            int          idx  = mItemSelectorContainer.Count;
            ItemSelector item = new ItemSelector();

            mItemSelectorContainer.Add(item);

            // create new checkbox
            Checkbox checkbox = item.CheckBoxWidget = new Checkbox(Window.getCPtr(
                                                                       WindowManager.Instance.CreateWindow("TaharezLook/Checkbox",
                                                                                                           "ItemCheckbox" + idx.ToString())).Handle, false);

            // set checkbox ID to selector ID
            checkbox.setID((uint)idx);
            checkbox.setMetricsMode(CeguiDotNet.MetricsMode.Absolute);
            checkbox.SetSize(100, ITEM_YSIZE);
            checkbox.setText(displayText);
            checkbox.setHoverTextColour(new CeguiDotNet.colour(1.0f, 1.0f, 0.0f));

            // add event handler for when checkbox state changes
            checkbox.SubscribeEvents();
            checkbox.CheckStateChanged += new WindowEventDelegate(handleCheckStateChanged);
            checkbox.SetPosition(0.0f, 12.0f + (ITEM_YSIZE + ITEM_YSPACING) * (float)idx);
            // add checkbox to the scroll pane
            mScrollablePane.AddChildWindow(checkbox);
        }
예제 #4
0
        public MPBodyMenu(CharacterEditorMenu root)
        {
            Root = root;

            headerTitle = "Body";
            statusTitle = "";

            FatherHead          = new ItemSelector(this, "Father's face", 45);
            MotherHead          = new ItemSelector(this, "Mother's face", 45);
            HeadWeight          = new ItemSlider(this, "Father/Mother face blend");
            FacialFeatures      = new ItemSelector(this, "Facial features", 20);
            FacialMorphStrength = new ItemSlider(this, "Facial features blend", -2.0f, 2.0f, 0.0f, 0.5f);
            FatherSkin          = new ItemSelector(this, "Father's skin color", 45);
            MotherSkin          = new ItemSelector(this, "Mother's skin color", 45);
            SkinWeight          = new ItemSlider(this, "Father/Mother skin blend");

            menuItems.Add(FatherHead);
            menuItems.Add(MotherHead);
            menuItems.Add(HeadWeight);
            menuItems.Add(FacialFeatures);
            menuItems.Add(FacialMorphStrength);
            menuItems.Add(FatherSkin);
            menuItems.Add(MotherSkin);
            menuItems.Add(SkinWeight);
            menuItems.Add(new MenuItemStandard {
                Title = "Back", OnActivate = CloseMenu
            });
        }
        public string GetNextCatalogItem(string type)
        {
            switch (type.ToLowerInvariant())
            {
            case "report":
                return(GetNextReport());

            case "mobilereport":
                return(ItemSelector.GetItem(this.ExistingMobileReports));

            case "kpi":
                return(ItemSelector.GetItem(this.ExistingKpis));

            case "powerbireport":
                return(ItemSelector.GetItem(this.ExistingPowerBIReports));

            case "powerbireportembedded":
                return(ItemSelector.GetItem(this.ExistingEmbeddedPowerBIReports));

            case "powerbireportdirectquery":
                return(ItemSelector.GetItem(this.ExistingDirectQueryPowerBIReports));

            default:
                throw new Exception("Type {0} is not supported.");
            }
        }
        /// <summary>
        /// Get next report item (random/sequetial)
        /// It gets from existing reports collection.
        /// </summary>
        /// <returns>Report Path That Exists</returns>
        public string GetNextReport()
        {
            string report;

            if (ItemSelector == null)
            {
                throw new Exception("The item selector need to be intialized for ContenManager before the GetNextReport() method is called");
            }

            if (isReportsWeightSet)
            {
                report = ItemSelector.GetItem(this.WeightedReports);
            }
            else
            {
                report = ItemSelector.GetItem(this.ExistingReports);
            }

            if (_badMethodReportCombinations != null && IsBlockedCombination(report))
            {
                report = GetNextReport();
            }

            return(report);
        }
예제 #7
0
        static void Main(string[] args)
        {
            // Lambda : 일회용 함수를 만드는데 사용하는 문법

            _items.Add(new Item()
            {
                ItemType = ItemType.Weapon, Rarity = Rarity.Normal
            });
            _items.Add(new Item()
            {
                ItemType = ItemType.Armor, Rarity = Rarity.Uncommon
            });
            _items.Add(new Item()
            {
                ItemType = ItemType.Ring, Rarity = Rarity.Rare
            });



            //이것은 무명함수 / 익명함수 람다식x
            Item item = FindItem(delegate(Item item)
            {
                return(item.ItemType == ItemType.Weapon);
            });

            //아래가 람다식
            Item item2 = FindItem((Item item) => { return(item.ItemType == ItemType.Weapon); });

            ItemSelector selector = new ItemSelector((Item item) => { return(item.ItemType == ItemType.Weapon); });

            // delegate를 직접 선언하지 않아도 이미 선언된 것이 존재
            // -> 반환 타입이 있을 경우 Func
            // -> 반환 타입이 없을 경우 Action
        }
예제 #8
0
        private SelectItemsResponse SelectItems(SelectTypes type, bool multiple)
        {
            SelectItemsRequestArgs args = new SelectItemsRequestArgs(type);

            args.Multiple = multiple;

            if (type == SelectTypes.Area)
            {
                if (ctlItemZFilter.UseMaxZ)
                {
                    args.UseMaxZ = true;
                    args.MaxZ    = ctlItemZFilter.MaxZ;
                }

                if (ctlItemZFilter.UseMinZ)
                {
                    args.UseMinZ = true;
                    args.MinZ    = ctlItemZFilter.MinZ;
                }
            }

            _lastResponse = null;

            ItemSelector selector = new ItemSelector();

            selector.OnSelection += new ItemSelector.ItemsSelectedtEvent(OnSelection);

            // wait for the extract to complete
            selector.SelectItems(args, true);
            WaitForSelection();

            selector.OnSelection -= new ItemSelector.ItemsSelectedtEvent(OnSelection);

            return(_lastResponse);
        }
예제 #9
0
        public override void OnClick(Node source, Vector2 mousePosition)
        {
            FilterAttribute filter = new FilterAttribute();

            filter.HideTypes.Add(typeof(void));
            filter.MaxMethodParam           = int.MaxValue;
            filter.SetMember                = true;
            filter.Public                   = true;
            filter.Instance                 = true;
            filter.Static                   = false;
            filter.DisplayDefaultStaticType = false;
            var customItems = ItemSelector.MakeCustomItems(source.ReturnType(), filter, source.ReturnType().PrettyName());

            if (customItems != null)
            {
                ItemSelector w = ItemSelector.ShowWindow(source, MemberData.none, filter, delegate(MemberData value) {
                    value.instance = new MemberData(source, MemberData.TargetType.ValueNode);
                    NodeEditorUtility.AddNewNode(graph.editorData, null, null, mousePositionOnCanvas, (MultipurposeNode n) => {
                        if (n.target == null)
                        {
                            n.target = new MultipurposeMember();
                        }
                        n.target.target = value;
                        MemberDataUtility.UpdateMultipurposeMember(n.target);
                        NodeEditorUtility.AddNewNode(graph.editorData, null, null,
                                                     new Vector2(mousePositionOnCanvas.x + n.editorRect.width + 150, mousePositionOnCanvas.y),
                                                     (NodeSetValue SV) => {
                            SV.target = new MemberData(n, MemberData.TargetType.ValueNode);
                        });
                    });
                    graph.Refresh();
                }, customItems).ChangePosition(GUIUtility.GUIToScreenPoint(mousePosition));
                w.displayDefaultItem = false;
            }
        }
예제 #10
0
    public void SaveGame()
    {
        GameStateData gsd = new GameStateData();

        //put all tree data into an array of FruitTreeData
        GameObject []   trees    = GameObject.FindGameObjectsWithTag("Tree");
        FruitTreeData[] treeData = new FruitTreeData[trees.Length];
        for (int i = 0; i < treeData.Length; i++)
        {
            treeData[i] = trees[i].GetComponent <FruitTree>().Serialize();
        }
        //create a new GameStateData
        gsd.trees = treeData;
        ItemSelector item = GameObject.FindGameObjectWithTag("Inventory").GetComponent <ItemSelector>();

        //fill in da blanks
        gsd.seedCount    = item.numSeeds;
        gsd.fruitCount   = item.numFruit;
        gsd.playerEnergy = transform.GetComponent <DirectionalMovement>().energy;
        gsd.playerPos    = transform.parent.position;
        gsd.playerRot    = Camera.main.transform.rotation;
        DayCycle day = GameObject.FindGameObjectWithTag("Sun").GetComponent <DayCycle>();

        gsd.seasonCode = day.seasonCode;
        gsd.dayCode    = day.dayCode;
        //serialize GameStateData to json
        string path = Application.persistentDataPath + "/saveData.json";

        //write json string to file in persistantDataPath
        File.WriteAllText(path, JsonUtility.ToJson(gsd));
        Debug.Log("Save success");
    }
예제 #11
0
        public SingleSelectorEditorForm(SelectorTypes selectorType)
        {
            InitializeComponent();
            _repWkr = RepositoryWorker.Instance();
            ItemSelector item;

            flp_items.Controls.Clear();
            switch (selectorType)
            {
            case SelectorTypes.Actions:
                for (int i = 0; i < _repWkr.Actions.Count; i++)
                {
                    item        = new ItemSelector(_repWkr.Actions[i].Id, _repWkr.Actions[i].Icon, _repWkr.Actions[i].Name);
                    item.Click += Item_Click;
                    flp_items.Controls.Add(item);
                }
                break;

            case SelectorTypes.Effects:
                for (int i = 0; i < _repWkr.Effects.Count; i++)
                {
                    item        = new ItemSelector(_repWkr.Effects[i].Id, _repWkr.Effects[i].Icon, _repWkr.Effects[i].Name);
                    item.Click += Item_Click;
                    flp_items.Controls.Add(item);
                }
                break;

            default:
                break;
            }
            item = null;
        }
예제 #12
0
    // Use this for initialization
    void Start()
    {
        if (!fader)
        {
            fader = GetComponent <Fader>();
        }
        if (!fader)
        {
            Debug.LogError("Please add a fader to " + gameObject.name);
            return;
        }

        selector              = gameObject.AddComponent <ItemSelector>();
        selector.numItems     = items.Length;
        selector.scrollRegion = 0.0f;
        selector.fader        = fader;

        if (SelectOnPush)
        {
            if (null == GetComponent <PushDetector>())
            {
                gameObject.AddComponent <PushDetector>();
            }
        }
    }
예제 #13
0
        protected override Control AddEditor(Control container)
        {
            ItemSelector selector = new ItemSelector(Name);

            selector.Placeholder(GetLocalizedText("Placeholder") ?? Placeholder);
            container.Controls.Add(selector);
            return(selector);
        }
예제 #14
0
        protected override Control AddEditor(Control container)
        {
            ItemSelector selector = new ItemSelector();

            selector.ID = Name;
            container.Controls.Add(selector);
            return(selector);
        }
예제 #15
0
    public virtual void BindSelector(ItemSelector selector)
    {
        _button = GetComponent <Button>();

        _button.onClick.RemoveAllListeners();
        _button.onClick.AddListener(OnClickButton);

        clickAction = selector.OnSelectedItem;
    }
예제 #16
0
        static void Main(string[] args)
        {
            //Initialize Modules
            changeMaker  = new ChangeMaker();
            coinReceiver = new CoinReceiver();
            itemSelector = new ItemSelector();

            adminPanelSelection();
        }
예제 #17
0
        protected static SelectContext CreateContext(
            Type enumType, RuleEditingContext context, ItemSelector parent, string contextName, Collection <object> exclusiveItems)
        {
            Type genericType  = typeof(EnumTypeSelectContext <>);
            Type specificType = genericType.MakeGenericType(enumType);

            return(Activator.CreateInstance(
                       specificType, context, parent, contextName, exclusiveItems) as SelectContext);
        }
예제 #18
0
    public static ItemSelector Instance()
    {
        if (instance == null)
        {
            instance = new ItemSelector();
        }

        return(instance);
    }
예제 #19
0
        public string getItemSelectorText(int index)
        {
            ItemSelector item = (ItemSelector)this.mItemSelectorContainer[index];

            if (item != null)
            {
                return(item.CheckBoxWidget.getText());
            }
            return("");
        }
예제 #20
0
 C14_Item FindItem(ItemSelector itemSelector)
 {
     foreach (var item in items)
     {
         if (itemSelector(item))
         {
             return(item);
         }
     }
     return(null);
 }
 // 내가 어떤 아이템을 착용하고 있는지 확인할 때
 static Item FindWeapon(ItemSelector selector)
 {
     foreach (Item item in _items)
     {
         if (selector(item))
         {
             return(item);
         }
     }
     return(null);
 }
예제 #22
0
 private void Awake()
 {
     if (Instance != null && Instance != this)
     {
         Destroy(gameObject);
     }
     else
     {
         Instance = this;
     }
 }
예제 #23
0
        public override bool UpdateItem(ContentItem item, Control editor)
        {
            ItemSelector selector = (ItemSelector)editor;

            if (selector.SelectedItem != item[Name] as ContentItem)
            {
                item[Name] = selector.SelectedItem;
                return(true);
            }
            return(false);
        }
예제 #24
0
        public override void UpdateEditor(ContentItem item, Control editor)
        {
            ItemSelector selector = (ItemSelector)editor;

            selector.SelectedItem = item[Name] as ContentItem;
            var pi = item.GetType().GetProperty(Name);

            if (pi != null)
            {
                selector.RequiredType = pi.PropertyType;
            }
        }
예제 #25
0
        public void TestItemSelector()
        {
            ItemSelector selector = new ItemSelector();
            List <int>   list     = new List <int>
            {
                0,
                3,
                13
            };

            Assert.Contains(selector.SelectItem(list), list);
        }
예제 #26
0
        public override void UpdateEditor(ContentItem item, Control editor)
        {
            ItemSelector selector = (ItemSelector)editor;

            selector.SelectedItem = item[Name] as ContentItem;
            var pi = item.GetType().GetProperty(Name);

            if (pi != null)
            {
                selector.RequiredType = pi.PropertyType;
            }
            selector.SelectableTypes = string.Join(",", (SelectableTypes ?? new[] { selector.RequiredType ?? typeof(ContentItem) }).Select(t => t.Name).ToArray());
        }
예제 #27
0
        public EcsEntity?findFreeReachableItemBySelector(ItemSelector selector, Vector3Int position)
        {
            LocalMap map = GameModel.localMap;

            // get items and positions
            // TODO add items in containers
            return(GameModel.get().itemContainer.onMapItems.all
                   .Where(selector.checkItem)
                   .Where(item => map.passageMap.inSameArea(position, item.pos())) // filter reachability
                   .Aggregate((current, item) => current == null || (distanceToItem(item, position) < distanceToItem(current, position))
                    ? item
                    : current)); // select nearest
        }
예제 #28
0
    void Awake()
    {
        // init the items container
        Transform t = transform.Find("ItemsContainer");

        if (t)
        {
            itemsContainer = t.gameObject;
        }
        else
        {
            itemsContainer = new GameObject("ItemsContainer");
        }
        itemsContainer.transform.parent        = transform;
        itemsContainer.transform.localPosition = Vector3.zero;
        itemsContainer.transform.localRotation = Quaternion.identity;
        itemsContainerTargetPos = itemsContainer.transform.localPosition;

        // fader
        if (!fader)
        {
            fader = GetComponent <Fader>();
        }
        if (!fader)
        {
            Debug.LogError("Please add a fader to " + gameObject.name);
            return;
        }

        // init the itemselector
        selector       = gameObject.AddComponent <ItemSelector>();
        selector.fader = fader;

        // push detector, if we need one
        if (SelectOnPush || PushSlide)
        {
            if (null == GetComponent <PushDetector>())
            {
                gameObject.AddComponent <PushDetector>();
            }
        }

        // fader for the pushslider, if we need one
        if (PushSlide)
        {
            pushslideFader           = gameObject.AddComponent <Fader>() as Fader;
            pushslideFader.direction = fader.direction;
            pushslideFader.size      = pushSliderSize;
        }
    }
        public ItemSelectorPopupForm(ItemSelector owner)
            : base(owner)
        {
            base.fCloseButtonStyle = BlobCloseButtonStyle.None;

            ScrollBar = new DevExpress.XtraEditors.VScrollBar();
            ScrollBar.ScrollBarAutoSize = true;
            ScrollBar.Scroll += ScrollBar_Scroll;
            ScrollBar.LookAndFeel.Assign(Properties.LookAndFeel);
            Controls.Add(ScrollBar);

            dragScrollTimer = new Timer();
            dragScrollTimer.Tick += DragScrollTimer_Tick;
        }
예제 #30
0
    /// <summary>
    /// Select the item currently held in the slot, or place an item in the slot
    /// </summary>
    public void SelectItem()
    {
        // If no item is currently selected
        if (!ItemSelector.Instance().ItemSelected())
        {
            if (HasItem())
            {
                ItemSelector.Instance().item   = ItemInSlot;
                ItemSelector.Instance().source = this;
                itemIcon.GetComponent <Image>().color = new Color(1, 1, 1, 0.5f);
                ItemSelector.Instance().isResultItem = isResultSlot;
            }
        }
        // If an item is currently selected and you are not clicking on the result ItemSlot
        else if (ItemSelector.Instance().ItemSelected() && !isResultSlot)
        {
            bool isPlaced = false;

            // If the currently selected item is NOT the result item and it does not match the item in the clicked ItemSlot
            if (!ItemSelector.Instance().isResultItem&& HasItem() && ItemSelector.Instance().item != ItemInSlot)
            {
                isPlaced = true;
            }
            // If the currently selected item matches the item in the clicked ItemSlot
            else if (HasItem() && ItemSelector.Instance().item == ItemInSlot)
            {
                SetContents(ItemInSlot, ItemCount + 1);
                ItemSelector.Instance().source.DecrementItemCount();
                isPlaced = true;
            }
            else if (!HasItem())
            {
                ItemSelector.Instance().source.DecrementItemCount();
                SetContents(ItemSelector.Instance().item, 1);
                isPlaced = true;
            }

            if (isPlaced)
            {
                ItemSelector.Instance().ClearSelection();
            }
            UpdateSlot();
        }
        // Deselects your item if its not the result item and you click on the result slot
        else if (ItemSelector.Instance().ItemSelected() && isResultSlot && !ItemSelector.Instance().isResultItem)
        {
            ItemSelector.Instance().ClearSelection();
        }
    }
예제 #31
0
        public void SelectorTestThree()
        {
            var inputEvts = new IInput[]
            {
                new BasicInput(InputType.PrimarySelect, InputState.Finish, 1.0),
                new BasicInput(InputType.PrimarySelect, InputState.Finish, 1.0),
                new BasicInput(InputType.PrimarySelect, InputState.Finish, 1.0),
                new BasicInput(InputType.PrimarySelect, InputState.Finish, 1.0),
            };
            var input = CreateFakeInput(inputEvts);
            var selector = new ItemSelector<object>(input, () => new object().ToOptional());

            input.InputEvents.Wait();
            Assert.That(selector.SelectedItems.Count, Is.EqualTo(1));
        }
예제 #32
0
        public void SelectorTestThree()
        {
            var inputEvts = new IInput[]
            {
                new BasicInput(InputType.PrimarySelect, InputState.Finish, 1.0),
                new BasicInput(InputType.PrimarySelect, InputState.Finish, 1.0),
                new BasicInput(InputType.PrimarySelect, InputState.Finish, 1.0),
                new BasicInput(InputType.PrimarySelect, InputState.Finish, 1.0),
            };
            var input    = CreateFakeInput(inputEvts);
            var selector = new ItemSelector <object>(input, () => new object().ToOptional());

            input.InputEvents.Wait();
            Assert.That(selector.SelectedItems.Count, Is.EqualTo(1));
        }
예제 #33
0
	// Use this for initialization
	void Start () {
        if (!fader) {
            fader = GetComponent<Fader>();
        }
        if (!fader) {
            Debug.LogError("Please add a fader to " + gameObject.name);
            return;
        }

        selector = gameObject.AddComponent<ItemSelector>();
        selector.numItems = items.Length;
        selector.scrollRegion = 0.0f;
        selector.fader = fader;

        if (SelectOnPush) {
            if (null == GetComponent<PushDetector>()) {
                gameObject.AddComponent<PushDetector>();
            }
        }
	}
예제 #34
0
        public Controller(XtraBinding XtraBinding, IControllerDynamicContext ControllerDynamicContext)
        {
            _xtraBinding = XtraBinding;

            _dynamicContext = ControllerDynamicContext;

            _dataSources = new ControllerDataSourcesCollection(this);

            _commands = new ControllerCommands(this);

            _itemSelector = new ItemSelector(this);

            _xtraBinding.Calculator.SetAppItemContext(TableContext);

            CreateUI();

            XtraBinding.xtraBindingOperation.EndFill += new XtraBindingOperationEndFillHandler(xtraBindingOperation_EndFill);

            XtraBinding.CalulatorCalculated += new EventHandler(XtraBinding_CalulatorCalculated);

            DynamicContext.TableContextChanged += new EventHandler(DynamicContext_TableContextChanged);
        }
예제 #35
0
 // Use this for initialization
 void Awake()
 {
     selector = GetComponent<ItemSelector> ();
     InvokeRepeating ("SpawnChance", spawnRate, spawnRate);
 }
예제 #36
0
    void Awake()
    {
        // init the items container
        Transform t = transform.Find("ItemsContainer");
        if (t) {
            itemsContainer = t.gameObject;
        } else {
            itemsContainer = new GameObject("ItemsContainer");
        }
        itemsContainer.transform.parent = transform;
        itemsContainer.transform.localPosition = Vector3.zero;
        itemsContainer.transform.localRotation = Quaternion.identity;
        itemsContainerTargetPos = itemsContainer.transform.localPosition;

        // fader
        if (!fader) {
            fader = GetComponent<Fader>();
        }
        if (!fader) {
            Debug.LogError("Please add a fader to " + gameObject.name);
            return;
        }

        // init the itemselector
        selector = gameObject.AddComponent<ItemSelector>();
        selector.fader = fader;
    
        // push detector, if we need one
        if (SelectOnPush || PushSlide) {
            if (null == GetComponent<PushDetector>()) {
                gameObject.AddComponent<PushDetector>();
            }
        }
		
		// fader for the pushslider, if we need one
		if (PushSlide) {
			pushslideFader = gameObject.AddComponent<Fader>() as Fader;
			pushslideFader.direction = fader.direction;
			pushslideFader.size = pushSliderSize;
		}
    }