示例#1
0
        public AppData.uniqueIDDevice.UIContainerData getUIContainerData()
        {
            //give the current container data
            AppData.uniqueIDDevice.UIContainerData myUiContainerData = new AppData.uniqueIDDevice.UIContainerData();


            myUiContainerData.adress               = adress;
            myUiContainerData.displayText          = displayText;
            myUiContainerData.function_UIContainer = function_UIContainer;
            myUiContainerData.readOnly             = readOnly;

            myUiContainerData.posX = transform.localPosition.x;
            myUiContainerData.posY = transform.localPosition.y;
            myUiContainerData.posZ = transform.localPosition.z;

            myUiContainerData.scaleX = transform.localScale.x;
            myUiContainerData.scaleY = transform.localScale.y;
            myUiContainerData.scaleZ = transform.localScale.z;

            myUiContainerData.specificContainerData1 = specificContainerData1;
            myUiContainerData.specificContainerData2 = specificContainerData2;
            myUiContainerData.specificContainerData3 = specificContainerData3;
            myUiContainerData.specificContainerData4 = specificContainerData4;
            myUiContainerData.specificContainerData5 = specificContainerData5;

            return(myUiContainerData);
        }
示例#2
0
        public override void setProperties(AppData.uniqueIDDevice.UIContainerData UIE)
        {
            //reset rotation
            //this.transform.eulerAngles = new Vector3(0, 0, 0);

            //finalizes in base class
            base.setProperties(UIE);
        }
示例#3
0
        public override void setProperties(AppData.uniqueIDDevice.UIContainerData UIE)
        {
            text          = GetComponent <LabelTheme>();
            text.Default  = "OPEN";
            text.Selected = "CLOSED";

            base.setProperties(UIE);
        }
示例#4
0
        public override void setProperties(AppData.uniqueIDDevice.UIContainerData UIE)
        {
            text      = GetComponent <CompoundButtonText>();
            text.Text = UIE.displayText;

            icon          = GetComponent <CompoundButtonIcon>();
            icon.IconName = UIE.specificContainerData1;


            //finalizes in base class
            base.setProperties(UIE);
        }
示例#5
0
        private Vector3 getScaleOrOneFromPrefab(AppData.uniqueIDDevice.UIContainerData uiData)
        {
            var vec = UIContainerBar.Instance.getUIElementPrefab(uiData.function_UIContainer);

            if (vec == null)
            {
                return(Vector3.one);
            }
            else
            {
                return(vec.transform.localScale);
            }
        }
示例#6
0
        private void OnSelectEvents_AdressMenu(MenuController.MenuElementInfo sender)
        {
            if (!sender.isSelected) // we have nothing to do on deselection events
            {
                return;
            }

            bool newItem = false;
            //we insert part of one sub-tupel (address - Function)

            //find out if it is a new item
            var currentlySelected = MenuAdress.getSelectedItem().ID; //currently selected in adress menu

            AppData.uniqueIDDevice.UIContainerData UIContainerData = null;
            if (currentlySelected != null)
            {
                //is there a container data to the currently selected
                UIContainerData = currentMenuInformationState.myUIContainerData.Find(x => x.adress == currentlySelected);
            }

            if (UIContainerData == null) //if there is no container data
            {                            // new item needs to be generated
                UIContainerData = new AppData.uniqueIDDevice.UIContainerData();
                newItem         = true;
            }



            //new chosen adress
            UIContainerData.adress = sender.ID;

            if (newItem)
            {
                //get the ui Function, that has not been assingned --> uifunction
                UIContainerData.function_UIContainer = MenuFunction.getSelectedItems().Find(x => UIContainerBar.Instance.getUIElementPrefab(x.ID) != null).ID;

                //add only if ne item
                currentMenuInformationState.myUIContainerData.Add(UIContainerData);
            }



            //back to the function menu
            StartCoroutine(restartFunctionMenu());
        }
示例#7
0
        /// <summary>
        /// This function needs to be called for initialization
        /// </summary>
        /// <param name="UIE"></param>
        public virtual void setProperties(AppData.uniqueIDDevice.UIContainerData UIE)
        {
            //WHATCH OUT, START HAS NOT BEEN RUN
            //set the properties
            adress = UIE.adress;

            displayText = UIE.displayText;

            readOnly = UIE.readOnly;

            function_UIContainer = UIE.function_UIContainer;

            specificContainerData1 = UIE.specificContainerData1;
            specificContainerData2 = UIE.specificContainerData2;
            specificContainerData3 = UIE.specificContainerData3;
            specificContainerData4 = UIE.specificContainerData4;
            specificContainerData5 = UIE.specificContainerData5;

            //sets the properties for this element
            //the object is now at the desired offset location
            Debug.Log(name + " posx: " + UIE.posX);
            this.transform.localPosition = new Vector3(UIE.posX, UIE.posY, UIE.posZ);
            Debug.Log(name + " posx real: " + transform.position.x);
            this.transform.localScale = new Vector3(UIE.scaleX, UIE.scaleY, UIE.scaleZ);

            //register as Subscriber for a change state
            ItemStates.Instance.subscribeToItem(adress, stateChanged);
            StartCoroutine(SetInitialState());//sets the current state after "start" ran

            //we want to be notified when manipulation starts, if our game object has a self manipulate attached
            GetComponent <SelfManipulate>()?.onManipulationStart.AddListener(onManipulationStart);
            //we want to be notified when manipulation ends, if our game object has a self manipulate attached
            GetComponent <SelfManipulate>()?.onManipulationEnd.AddListener(onManipulationEnd);

            //now UI element is ready to go
            Initialized = true;
        }
示例#8
0
        /// <summary>
        /// This methode takes Information about an UIElement, parses it, and generates it
        /// </summary>
        /// <param name="UIElemProps"></param>
        public void addUiElement(AppData.uniqueIDDevice.UIContainerData UIElemProps)
        {
            GameObject UIElement = null;

            switch (UIElemProps.function_UIContainer)
            {
            case AppData.UIFunction_Switch:
                //instantiate and
                //Attach UIButton Script and
                //give the button the informations
                UIElement = Instantiate(UIButton_Prefab, UIContainerParent);

                UIElement.AddComponent <UIButton>().setProperties(UIElemProps);

                break;

            case AppData.UIFunction_Contact:
                //instantiate and
                //Attach UIButton Script and
                //give the Toggle the informations
                UIElement = Instantiate(UIContact_Prefab, UIContainerParent);

                UIElement.AddComponent <UIContact>().setProperties(UIElemProps);
                break;

            case AppData.UIFunction_Toggle:
                //instantiate and
                //Attach UIToggle Script and
                //give the Toggle the informations
                UIElement = Instantiate(UIToggle_Prefab, UIContainerParent);

                UIElement.AddComponent <UIToggle>().setProperties(UIElemProps);
                break;

            case AppData.UIFunction_Slider:

                UISlider_Prefab.gameObject.SetActive(false);

                GameObject UIElement_TEMP = Instantiate(UISlider_Prefab);     //instantiate somewhere

                UISlider_Prefab.gameObject.SetActive(true);

                //attach UISlider Script and preinitialize
                UISlider UIs_TEMP = UIElement_TEMP.AddComponent <UISlider>();
                UIs_TEMP.preInitialization();

                //now instantiate after initialisation, because then the properies of the script are initialized (Max Slider Value,remove billboard)
                UIElement = Instantiate(UIElement_TEMP, UIContainerParent);

                //get the new script, we added earlier
                UISlider UIs = UIElement.GetComponent <UISlider>();

                //init
                UIs.initialization();

                UIElement.SetActive(true);

                //then set Properties
                UIs.setProperties(UIElemProps);



                //destroy the tmp gameObj
                Destroy(UIElement_TEMP);

                break;

            case AppData.UIFunction_Text:

                //instantiate and
                //Attach UIText Script and
                //give the UIText the informations
                UIElement = Instantiate(UIText_Prefab, UIContainerParent);

                UIElement.AddComponent <UIText>().setProperties(UIElemProps);
                break;

            case AppData.UIFunction_Color:

                UIElement = Instantiate(UIColorPicker_Prefab, UIContainerParent);

                UIElement.AddComponent <UIColorPicker>().setProperties(UIElemProps);
                break;

            case AppData.UIFunction_Rollershutter:
                UIElement = Instantiate(UIRollershutter_Prefab, UIContainerParent);

                UIElement.GetComponent <UIRollershutter>().setProperties(UIElemProps);
                break;

            case AppData.UIFunction_Player:
                UIElement = Instantiate(UIPlayer_Prefab, UIContainerParent);

                UIElement.GetComponent <UIPlayer>().setProperties(UIElemProps);
                break;

            default:
                Debug.Log("Did not understand " + UIElemProps.function_UIContainer + " as a UIFunction");
                //do nothing if nothing was recognized
                break;
            }

            //TODO: make dynamic with action somehow
            GetComponent <ToggleEdit>().prepareGameobjectForManipulation(UIElement, ManipulationMode.MoveAndScale);

            Debug.Log("added Ui Element: " + UIElement.name);
        }