Exemple #1
0
    public void createSelection(POICoordinatesObject poiCoordinatesObject)
    {
        GameObject POIButton = (GameObject)Resources.Load("Prefab/POIButton", typeof(GameObject));

        POIButton = Instantiate(POIButton);
        POIButton.transform.rotation = transform.rotation;
        POIButton.GetComponent <ButtonConfigHelper>().MainLabelText = poiCoordinatesObject.ToString();
        POIButton.GetComponent <ButtonAttribute>().setID_coordinates(ButtonID, poiCoordinatesObject);
        POIButton.GetComponent <Interactable>().OnClick.AddListener((() => OnQueryRemoveButtonLogic(POIButton, poiCoordinatesObject)));
        POIButton.gameObject.transform.parent = transform.GetChild(2).GetChild(0);
        queryList[ButtonID] = POIButton;
        ButtonID++;
        scrollingObjectCollection.UpdateCollection();
    }
Exemple #2
0
        public void MakeScrollingList()
        {
            if (scrollCollection == null)
            {
                GameObject newScroll = new GameObject("Scrolling Object Collection");
                newScroll.transform.parent        = transform;
                newScroll.transform.localPosition = new Vector3(-0.0178f, 0.0165f, -0.0047f);
                newScroll.transform.localRotation = Quaternion.identity;
                newScroll.SetActive(false);
                scrollCollection = newScroll.AddComponent <ScrollingObjectCollection>();

                // Prevent the scrolling collection from running until we're done dynamically populating it.
                scrollCollection.SetUpAtRuntime        = false;
                scrollCollection.CellHeight            = 0.032f;
                scrollCollection.CellWidth             = 0.032f;
                scrollCollection.Tiers                 = 3;
                scrollCollection.ViewableArea          = 5;
                scrollCollection.DragTimeThreshold     = 0.75f;
                scrollCollection.HandDeltaMagThreshold = 0.8f;
                scrollCollection.TypeOfVelocity        = ScrollingObjectCollection.VelocityType.FalloffPerItem;
            }

            if (!lazyLoad)
            {
                for (int i = 0; i < numItems; i++)
                {
                    MakeItem(dynamicItem, scrollCollection.transform);
                }
                scrollCollection.gameObject.SetActive(true);
                scrollCollection.UpdateCollection();
            }
            else
            {
                if (loader != null)
                {
                    loader.SetActive(true);
                }

                StartCoroutine(UpdateListOverTime(loader, itemsPerFrame));
            }
        }
Exemple #3
0
    public void createResultObjects(int v_size)
    {
        GameObject Container = scrollingObjectCollection.transform.GetChild(0).gameObject;

        // List<GameObject> ObjectList = new List<GameObject>();
        picturePointerDatasList = new List <PicturePointerData>();

        int horizontal_size = 3;
        //int vertical_size = t_size/horizontal_size;

        float init_xpos = -0.4f;

        float xpos = -1f;
        float ypos = 0.8f;
        float zpos = 0.2f;

        float xpos_offset = 0.4f;
        float ypos_offset = -0.3f;

        // int count = 0;
        //
        //     for (float y = 0; y < vertical_size; y++)
        //     {
        //         for (float x = 0; x < horizontal_size; x++)
        //         {
        //             ObjectList.Add(Instantiate(resultObject, new Vector3(xpos, ypos, 0), Quaternion.identity));
        //             xpos = xpos + xpos_offset;
        //             count++;
        //         }
        //         ypos = ypos + ypos_offset;
        //         xpos = init_xpos;
        //     }


        int counter = 0;

        // ObjectList.Add(Instantiate(resultObject, new Vector3(xpos, ypos, zpos), Quaternion.identity));
        picturePointerDatasList.Add(new PicturePointerData(Instantiate(resultObject, new Vector3(xpos, ypos, zpos), Quaternion.identity), counter));
        //tempObject.gameObject.transform.parent = ScrollableResult.transform.GetChild(0).GetChild(0).transform;

        counter++;
        while (counter < v_size)
        {
            if (counter % horizontal_size != 0)
            {
                xpos = xpos + xpos_offset;     // Moving to right with spaces
            }

            if (counter % horizontal_size == 0)     // once horizonal limit reached go to next line and reset xpos
            {
                ypos = ypos + ypos_offset;
                xpos = init_xpos;
            }
            picturePointerDatasList.Add(new PicturePointerData(Instantiate(resultObject, new Vector3(xpos, ypos, zpos), Quaternion.identity), counter));
            // ObjectList.Add(Instantiate(resultObject, new Vector3(xpos, ypos, zpos), Quaternion.identity));
            counter++;
        }

        int listcount = 0;

        foreach (var VARIABLE in textureDatas)
        {
            // ObjectList[listcount].GetComponent<Renderer>().material.mainTexture = VARIABLE.getData();
            picturePointerDatasList[listcount].getGameObject().GetComponent <Renderer>().material.mainTexture = VARIABLE.getData();
            picturePointerDatasList[listcount].getGameObject().AddComponent <PictureAttribute>();
            picturePointerDatasList[listcount].getGameObject().GetComponent <PictureAttribute>().setlatlon(VARIABLE.getLat(), VARIABLE.getLon(), VARIABLE.gethea());
            picturePointerDatasList[listcount].getGameObject().GetComponent <PictureAttribute>().width =
                VARIABLE.getData().width;
            picturePointerDatasList[listcount].getGameObject().GetComponent <PictureAttribute>().height =
                VARIABLE.getData().height;
            listcount++;
        }

        foreach (var VARIABLE in picturePointerDatasList)
        {
            var attribute = VARIABLE.getGameObject().GetComponent <PictureAttribute>();

            VARIABLE.getGameObject().transform.localScale = rxt(attribute);


            VARIABLE.getGameObject().gameObject.transform.parent =
                transform.GetChild(1).GetChild(0).GetChild(1).GetChild(0).transform;

            //VARIABLE.getGameObject().AddComponent<PictureAttribute>();
            VARIABLE.getGameObject().GetComponent <PictureAttribute>().ID          = VARIABLE.getID();
            VARIABLE.getGameObject().GetComponent <PictureAttribute>().PointerData = VARIABLE;
            AddToPOI(VARIABLE.getGameObject().GetComponent <PictureAttribute>().latitude, VARIABLE.getGameObject().GetComponent <PictureAttribute>().longitude, VARIABLE.getID(), VARIABLE.getGameObject(), VARIABLE.getGameObject().GetComponent <PictureAttribute>().heading);

            var touchable = VARIABLE.getGameObject().AddComponent <NearInteractionTouchableVolume>();
            touchable.EventsToReceive = TouchableEventType.Pointer;
            var touchhandler = VARIABLE.getGameObject().AddComponent <PointerHandler>();
            touchhandler.OnPointerUp.AddListener((e) => SearchIDProvider(touchhandler.gameObject, picturePointerDatasList));
        }

        scrollingObjectCollection.UpdateCollection();
    }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUI.BeginChangeCheck();

            ScrollingObjectCollection scrollContainer = (ScrollingObjectCollection)target;

            EditorGUILayout.LabelField("General Properties", EditorStyles.boldLabel);
            using (new EditorGUI.IndentLevelScope())
            {
                EditorGUILayout.PropertyField(canScroll);
                EditorGUILayout.PropertyField(scrollDirection);
                EditorGUILayout.PropertyField(setUpAtRuntime);
                EditorGUILayout.PropertyField(useCameraPreRender);
                EditorGUILayout.Space();
            }

            EditorGUILayout.LabelField("Collection Properties", EditorStyles.boldLabel);

            using (new EditorGUI.IndentLevelScope())
            {
                EditorGUILayout.PropertyField(sorting);
                EditorGUILayout.PropertyField(cellWidth);
                EditorGUILayout.PropertyField(cellHeight);
                EditorGUILayout.PropertyField(tiers);
                EditorGUILayout.PropertyField(viewableArea);
                EditorGUILayout.Space();
            }

            EditorGUILayout.Space();

            if (GUILayout.Button("Update Collection"))
            {
                scrollContainer.UpdateCollection();
                EditorUtility.SetDirty(scrollContainer);
            }

            EditorGUILayout.Space();

            EditorGUILayout.HelpBox("In order for a ScrollableObjectCollection to work properly with PressableButton, ReleaseOnTouchEnd must be inactive.", MessageType.Info);

            if (GUILayout.Button("Set Up PressableButtons"))
            {
                PressableButton[] pBs = scrollContainer.transform.GetComponentsInChildren <PressableButton>();
                foreach (PressableButton p in pBs)
                {
                    p.ReleaseOnTouchEnd = false;
                }

                PhysicalPressEventRouter[] routers = scrollContainer.transform.GetComponentsInChildren <PhysicalPressEventRouter>();
                foreach (PhysicalPressEventRouter r in routers)
                {
                    r.InteractableOnClick = PhysicalPressEventRouter.PhysicalPressEventBehavior.EventOnClickCompletion;
                }
            }

            EditorGUILayout.LabelField("Scrolling Properties", EditorStyles.boldLabel);

            using (new EditorGUI.IndentLevelScope())
            {
                EditorGUILayout.PropertyField(dragTimeThreshold);
                EditorGUILayout.PropertyField(handDeltaMagThreshold);
                EditorGUILayout.PropertyField(useNearScrollBoundary);
                EditorGUILayout.Space();

                EditorGUILayout.PropertyField(occlusionPositionPadding);
                EditorGUILayout.PropertyField(occlusionScalePadding);
                EditorGUILayout.Space();

                EditorGUILayout.PropertyField(animationCurve);
                EditorGUILayout.PropertyField(animationLength);
                EditorGUILayout.PropertyField(disableClippedItems);
            }

            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Velocity Properties", EditorStyles.boldLabel);
            using (new EditorGUI.IndentLevelScope())
            {
                EditorGUILayout.PropertyField(velocityType);

                if (velocityType.enumValueIndex <= 1)
                {
                    EditorGUILayout.PropertyField(velocityMultiplier);
                    EditorGUILayout.PropertyField(velocityDampen);
                    EditorGUILayout.PropertyField(bounceMultiplier);
                }
            }

            EditorGUILayout.Space();

            showUnityEvents = EditorGUILayout.Foldout(showUnityEvents, "Unity Events: ", true);

            if (showUnityEvents)
            {
                using (new EditorGUI.IndentLevelScope())
                {
                    EditorGUILayout.PropertyField(clickEvent);
                    EditorGUILayout.PropertyField(touchEvent);
                    EditorGUILayout.PropertyField(untouchEvent);
                    EditorGUILayout.PropertyField(momentumEvent);
                }
            }

            EditorGUILayout.Space();

            showOverrideButtons = EditorGUILayout.Foldout(showOverrideButtons, "Scrolling debug buttons", true);

            EditorGUILayout.Space();

            if (showOverrideButtons)
            {
                using (new EditorGUI.IndentLevelScope())
                {
                    animateTransition = EditorGUILayout.Toggle("Animate", animateTransition);

                    using (new EditorGUILayout.HorizontalScope())
                    {
                        if (GUILayout.Button("Page Up"))
                        {
                            scrollContainer.PageBy(1, animateTransition);
                        }
                        if (GUILayout.Button("Page Down"))
                        {
                            scrollContainer.PageBy(-1, animateTransition);
                        }
                    }

                    using (new EditorGUILayout.HorizontalScope())
                    {
                        amountOfLinesToMoveTo = EditorGUILayout.IntField(amountOfLinesToMoveTo);
                        if (GUILayout.Button("Move By Tiers"))
                        {
                            scrollContainer.MoveByLines(amountOfLinesToMoveTo, animateTransition);
                        }
                    }

                    using (new EditorGUILayout.HorizontalScope())
                    {
                        amountOfItemsToMoveBy = EditorGUILayout.IntField(amountOfItemsToMoveBy);
                        if (GUILayout.Button("Move By Items"))
                        {
                            scrollContainer.MoveByItems(amountOfItemsToMoveBy, animateTransition);
                        }
                    }

                    using (new EditorGUILayout.HorizontalScope())
                    {
                        indexToMoveTo = EditorGUILayout.IntField(indexToMoveTo);
                        if (GUILayout.Button("Move To Index"))
                        {
                            scrollContainer.MoveTo(indexToMoveTo, animateTransition);
                        }
                    }
                }
            }

            serializedObject.ApplyModifiedProperties();

            if (EditorGUI.EndChangeCheck())
            {
                for (int i = 0; i < nodeList.arraySize; i++)
                {
                    var       node          = nodeList.GetArrayElementAtIndex(i);
                    Transform nodeTransform = node.FindPropertyRelative("Transform").objectReferenceValue as Transform;
                    if (nodeTransform == null)
                    {
                        continue;
                    }

                    if (!CheckForStandardShader(nodeTransform.GetComponentsInChildren <Renderer>()))
                    {
                        Debug.LogWarning(nodeTransform.name + " has a renderer that is not using " + StandardShaderUtility.MrtkStandardShaderName + ". This will result in unexpected results with ScrollingObjectCollection");
                    }
                }
            }
        }