public HMSIAPProductAdderDrawer(IIAPProductManipulator productManipulator)
        {
            _productManipulator = productManipulator;

            _identifierTextField = new TextField.TextField("Identifier: ", "").SetLabelWidth(70);
            _typeDropdown        = new EnumDropdown(HMSIAPProductType.Consumable);

            SetupSequence();
        }
Esempio n. 2
0
    private void Initialize()
    {
        if (m_HasInitialized)
        {
            return;
        }
        // Create Value Throttles
        angleThrottle          = new ValueThrottle <float>(bendUpdateThrottleMs);
        angleThrottle.onValue += ListenerAngle;
        rulerThrottle          = new ValueThrottle <float>(bendUpdateThrottleMs);
        rulerThrottle.onValue += ListenerRuler;
        intThrottle            = new ValueThrottle <int>(bendUpdateThrottleMs);
        intThrottle.onValue   += ListenerInteger;

        // Create Prefabs
        m_AngleWidget = Instantiate(angleWidgetPrefab);
        m_AngleWidget.SetParent(widgetView, false);
        m_AngleWidget.gameObject.SetActive(false);
        AngleSlider angleSlider = m_AngleWidget.GetComponentsInChildren <AngleSlider>(true)[0];

        angleSlider.onValueChanged.AddListener(angleThrottle.Set);

        m_RulerWidget = Instantiate(rulerWidgetPrefab);
        m_RulerWidget.SetParent(widgetView, false);
        m_RulerWidget.gameObject.SetActive(false);
        MultiRulerSlider rulerSlider = m_RulerWidget.GetComponentsInChildren <MultiRulerSlider>(true)[0];

        rulerSlider.onValueChanged.AddListener(rulerThrottle.Set);
        rulerSlider.rulerDisplayType = Engine.unitType;

        m_IntegerWidget = Instantiate(integerWidgetPrefab);
        m_IntegerWidget.SetParent(widgetView, false);
        m_IntegerWidget.gameObject.SetActive(false);
        IntegerSlider integerSlider = m_IntegerWidget.GetComponentsInChildren <IntegerSlider>(true)[0];

        integerSlider.onValueChanged = intThrottle.Set;

        m_EnumWidget = Instantiate(enumWidgetPrefab);
        m_EnumWidget.SetParent(widgetView, false);
        m_EnumWidget.gameObject.SetActive(false);
        EnumDropdown enumDropdown = m_EnumWidget.GetComponentsInChildren <EnumDropdown>(true)[0];

        enumDropdown.onValueChanged.AddListener(ListenerEnum);

        m_HelpWidget = Instantiate(helpWidgetPrefab);
        m_HelpWidget.SetParent(widgetView, false);
        m_HelpWidget.gameObject.SetActive(false);
        BendHelp bendHelp = m_HelpWidget.GetComponentsInChildren <BendHelp>(true)[0];

        bendHelp.onValueChanged = ListenerHelp;

        m_OutputText = outputView.GetComponentsInChildren <TextColumns>(true)[0];
        m_OutputText.maxCharPerLineTotal = Engine.GetLanguageMaxParameterStringLength() * m_OutputText.columns.Count;


        m_HasInitialized = true;
    }
Esempio n. 3
0
    protected override void OnInitialize()
    {
        Vector2 winSize = new Vector3( 312.0f, 265.0f );
        maxSize = winSize;
        minSize = winSize;        

        autoRepaintOnSceneChange = true;

        m_root = new Control();
        m_root.SetSize( 100.0f, 100.0f, Control.MetricsUnits.Percentage, Control.MetricsUnits.Percentage );
        m_root.AddDecorator( new StackContent() );

        AddChild( m_root );

        // Input object field
        m_original = new ObjectField( typeof( GameObject ), true, null, "Original" );
        m_original.SetHeight( 26.0f, Control.MetricsUnits.Pixel );
        m_original.SetWidth( 100.0f, Control.MetricsUnits.Percentage );
        m_original.SetMargin( 5.0f, 5.0f, 5.0f, 5.0f );
        m_root.AddChild( m_original );

        // Rotation pivot point
        m_pivot = new Vector3Field( Vector3.zero, "Pivot:" );
        m_pivot.SetHeight( 40.0f, Control.MetricsUnits.Pixel );
        m_pivot.SetWidth( 100.0f, Control.MetricsUnits.Percentage );
        m_pivot.SetMargin( 5.0f, 5.0f, 5.0f, 5.0f );
        m_root.AddChild( m_pivot );

        // Transform control
        m_transform = new TransformControl();
        m_transform.SetWidth( 100.0f, Control.MetricsUnits.Percentage );
        m_transform.SetMargin( 5.0f, 5.0f, 5.0f, 5.0f );
        m_root.AddChild( m_transform );

        // Count field
        m_count = new IntField( 1, "Duplicate Count:" );
        m_count.SetHeight( 26.0f, Control.MetricsUnits.Pixel );
        m_count.SetWidth( 100.0f, Control.MetricsUnits.Percentage );
        m_count.SetMargin( 5.0f, 5.0f, 5.0f, 5.0f );
        m_root.AddChild( m_count );

        // Space field
        m_space = new EnumDropdown( Space.World, "Space:" );
        m_space.SetHeight( 26.0f, Control.MetricsUnits.Pixel );
        m_space.SetWidth( 100.0f, Control.MetricsUnits.Percentage );
        m_space.SetMargin( 5.0f, 5.0f, 5.0f, 5.0f );
        m_root.AddChild( m_space );

        // Duplicate button
        m_duplicate = new Button( "Duplicate" );
        m_duplicate.SetWidth( 100.0f, Control.MetricsUnits.Percentage );
        m_duplicate.SetMargin( 5.0f, 5.0f, 5.0f, 5.0f );
        m_duplicate.Enabled = false;
        m_root.AddChild( m_duplicate );

        // Events
        m_original.ValueChange += m_original_ValueChange;
        m_count.ValueChange += m_count_ValueChange;
        m_duplicate.Clicked += m_duplicate_Clicked;

        SceneView.onSceneGUIDelegate += SceneViewGUI;
    }
Esempio n. 4
0
    protected override void OnInitialize()
    {
        Vector2 winSize = new Vector3(312.0f, 265.0f);

        maxSize = winSize;
        minSize = winSize;

        autoRepaintOnSceneChange = true;

        m_root = new Control();
        m_root.SetSize(100.0f, 100.0f, Control.MetricsUnits.Percentage, Control.MetricsUnits.Percentage);
        m_root.AddDecorator(new StackContent());

        AddChild(m_root);

        // Input object field
        m_original = new ObjectField(typeof(GameObject), true, null, "Original");
        m_original.SetHeight(26.0f, Control.MetricsUnits.Pixel);
        m_original.SetWidth(100.0f, Control.MetricsUnits.Percentage);
        m_original.SetMargin(5.0f, 5.0f, 5.0f, 5.0f);
        m_root.AddChild(m_original);

        // Rotation pivot point
        m_pivot = new Vector3Field(Vector3.zero, "Pivot:");
        m_pivot.SetHeight(40.0f, Control.MetricsUnits.Pixel);
        m_pivot.SetWidth(100.0f, Control.MetricsUnits.Percentage);
        m_pivot.SetMargin(5.0f, 5.0f, 5.0f, 5.0f);
        m_root.AddChild(m_pivot);

        // Transform control
        m_transform = new TransformControl();
        m_transform.SetWidth(100.0f, Control.MetricsUnits.Percentage);
        m_transform.SetMargin(5.0f, 5.0f, 5.0f, 5.0f);
        m_root.AddChild(m_transform);

        // Count field
        m_count = new IntField(1, "Duplicate Count:");
        m_count.SetHeight(26.0f, Control.MetricsUnits.Pixel);
        m_count.SetWidth(100.0f, Control.MetricsUnits.Percentage);
        m_count.SetMargin(5.0f, 5.0f, 5.0f, 5.0f);
        m_root.AddChild(m_count);

        // Space field
        m_space = new EnumDropdown(Space.World, "Space:");
        m_space.SetHeight(26.0f, Control.MetricsUnits.Pixel);
        m_space.SetWidth(100.0f, Control.MetricsUnits.Percentage);
        m_space.SetMargin(5.0f, 5.0f, 5.0f, 5.0f);
        m_root.AddChild(m_space);

        // Duplicate button
        m_duplicate = new Button("Duplicate");
        m_duplicate.SetWidth(100.0f, Control.MetricsUnits.Percentage);
        m_duplicate.SetMargin(5.0f, 5.0f, 5.0f, 5.0f);
        m_duplicate.Enabled = false;
        m_root.AddChild(m_duplicate);

        // Events
        m_original.ValueChange += m_original_ValueChange;
        m_count.ValueChange    += m_count_ValueChange;
        m_duplicate.Clicked    += m_duplicate_Clicked;

        SceneView.onSceneGUIDelegate += SceneViewGUI;
    }
Esempio n. 5
0
    private void DisplayWidget(int id)
    {
        // Remove any active Highlighting
        m_Bend.SetHighlight(null);
        m_HelpWidget.GetComponentInChildren <BendHelp>().UnSelect();

        // Don't reselect the same Widget
        if (m_ActiveParameter == id)
        {
            return;
        }
        // Disable current Widget
        if (m_ActiveWidget != null)
        {
            m_ActiveWidget.gameObject.SetActive(false);
        }
        m_ActiveParameter = id;

        BendParameter      param = m_Bend.inputParameters[id];
        EBendParameterType type  = param.type;

        object[] range = BendParameter.GetRange(param.name);

        switch (type)
        {
        case EBendParameterType.FloatAngle:
            m_ActiveWidget = m_AngleWidget;
            m_ActiveWidget.gameObject.SetActive(true);
            AngleSlider ans = m_AngleWidget.GetComponentInChildren <AngleSlider>();
            ans.SetRange((float)range[0], (float)range[1]);
            ans.value = (float)param.value;
            break;

        case EBendParameterType.Float:
            m_ActiveWidget = m_RulerWidget;
            m_ActiveWidget.gameObject.SetActive(true);
            MultiRulerSlider mr = m_RulerWidget.GetComponentInChildren <MultiRulerSlider>();
            mr.SetRange((float)range[1]);
            mr.Set((float)param.value, false);
            break;

        case EBendParameterType.Integer:
            m_ActiveWidget = m_IntegerWidget;
            m_ActiveWidget.gameObject.SetActive(true);
            IntegerSlider ins = m_IntegerWidget.GetComponentInChildren <IntegerSlider>();
            ins.SetRange((int)range[0], (int)range[1]);
            ins.SetName(BendParameter.GetStringValue(param.name));
            ins.value = (int)param.value;
            break;

        case EBendParameterType.StringEnum:
            m_ActiveWidget = m_EnumWidget;
            m_ActiveWidget.gameObject.SetActive(true);

            EnumDropdown ed = m_EnumWidget.GetComponentInChildren <EnumDropdown>();
            List <Dropdown.OptionData> enumList = ed.options;
            StringEnum se        = (StringEnum)param.valueObject;
            int        enumStart = (int)range[0];
            int        enumEnd   = (int)range[1];
            enumList.Clear();
            for (int i = enumStart; i <= enumEnd; ++i)
            {
                enumList.Add(new EnumDropdown.EnumOptionData(se.ToStringValue(i), null, se.ToDescription(i)));
            }
            ed.value = (int)param.value;
            ed.Refresh();
            break;

        default:
            throw new ArgumentException("BendInputScreen: DisplayWidget() Invalid type.");
        }
    }