Esempio n. 1
0
    private void UpdateMenuProject()
    {
        overrides.Clear();

        foreach (Parameter param in CurrentObject.ObjectParameters.Values.ToList())
        {
            ActionObjectParameterOverride overrideParam = Instantiate(ParameterOverridePrefab, Parameters.transform).GetComponent <ActionObjectParameterOverride>();
            overrideParam.transform.SetAsLastSibling();
            overrideParam.Init(param.GetStringValue(), false, param.ParameterMetadata, CurrentObject.Data.Id, !SceneManager.Instance.SceneStarted, DynamicContentLayout, CanvasRoot);
            if (CurrentObject.Overrides.TryGetValue(param.Name, out Parameter p))
            {
                Debug.LogError(p);
                overrideParam.SetValue(p.GetStringValue(), true);
            }
            overrides[param.Name] = overrideParam;
        }
    }
Esempio n. 2
0
    public override void UpdateMenu()
    {
        base.UpdateMenu();



        overrides.Clear();
        createAPBtn.SetInteractivity(CurrentObject.ActionObjectMetadata.HasPose);

        foreach (Parameter param in CurrentObject.ObjectParameters.Values.ToList())
        {
            ActionObjectParameterOverride overrideParam = Instantiate(ParameterOverridePrefab, Parameters.transform).GetComponent <ActionObjectParameterOverride>();
            overrideParam.transform.SetAsLastSibling();
            overrideParam.Init(param.GetStringValue(), false, param.ParameterMetadata, CurrentObject.Data.Id);
            Debug.LogError(CurrentObject.Overrides.Count);
            if (CurrentObject.Overrides.TryGetValue(param.Name, out Parameter p))
            {
                Debug.LogError(p);
                overrideParam.SetValue(p.GetStringValue(), true);
            }
            overrides[param.Name] = overrideParam;
        }

        foreach (ActionPoint actionPoint in CurrentObject.GetActionPoints())
        {
            Button button = GameManager.Instance.CreateButton(ActionPointsList.transform, actionPoint.Data.Name);
            button.onClick.AddListener(() => ShowActionPoint(actionPoint));

            // Add EventTrigger OnPointerEnter and OnPointerExit - to be able to highlight corresponding AP when hovering over button
            OutlineOnClick APoutline    = actionPoint.GetComponent <OutlineOnClick>();
            EventTrigger   eventTrigger = button.gameObject.AddComponent <EventTrigger>();
            // Create OnPointerEnter entry
            EventTrigger.Entry OnPointerEnter = new EventTrigger.Entry {
                eventID = EventTriggerType.PointerEnter
            };
            OnPointerEnter.callback.AddListener((eventData) => APoutline.Highlight());
            eventTrigger.triggers.Add(OnPointerEnter);

            // Create OnPointerExit entry
            EventTrigger.Entry OnPointerExit = new EventTrigger.Entry {
                eventID = EventTriggerType.PointerExit
            };
            OnPointerExit.callback.AddListener((eventData) => APoutline.UnHighlight());
            eventTrigger.triggers.Add(OnPointerExit);
        }
    }