示例#1
0
    void OnTriggerEnter(Collider other)
    {
        if (other.isTrigger)
        {
            return;
        }

        Camera.main.GetComponent <CameraMovement>().enabled = false;
        PopupGUI.Popup(exitMessage, PopupClosed);
    }
示例#2
0
        /// <inheritdoc />
        protected override void RenderMemberControl(Rect position)
        {
            var options = GetNameOptions();

            PopupOption <AnimatorParameter> selectedOption = null;
            PopupOption <AnimatorParameter> noneOption     = new PopupOption <AnimatorParameter>(null, "No Parameter");

            AnimatorParameter value = GetValue();

            if (value != null)
            {
                string label = value.name;

                AnimatorParameter valueInOptions = options.Select(option => option.value).FirstOrDefault(ap => ap.Corresponds(value));

                if (valueInOptions != null)
                {
                    selectedOption = new PopupOption <AnimatorParameter>(valueInOptions, label);
                }
                else
                {
                    selectedOption = new PopupOption <AnimatorParameter>(value, label);
                }
            }

            // Make sure the callback uses the property of this drawer, not at its later value.
            var propertyNow = property;

            bool enabled = targets.Any(target => target != null);

            if (!enabled)
            {
                EditorGUI.BeginDisabledGroup(true);
            }

            PopupGUI <AnimatorParameter> .Render
            (
                position,
                newValue =>
            {
                Update(propertyNow);
                SetValue(newValue);
                propertyNow.serializedObject.ApplyModifiedProperties();
            },
                options,
                selectedOption,
                noneOption,
                nameProperty.hasMultipleDifferentValues
            );

            if (!enabled)
            {
                EditorGUI.EndDisabledGroup();
            }
        }
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        EditorGUI.BeginProperty(position, label, property);

        List <PopupOption <string> > options = new List <PopupOption <string> >();

        if (UnityObject.FindObjectOfType <Timekeeper>() != null)
        {
            Timekeeper timekeeper = Timekeeper.instance;

            foreach (GlobalClock globalClock in timekeeper
                     .GetComponents <GlobalClock>()
                     .Where(gc => !string.IsNullOrEmpty(gc.key)))
            {
                options.Add(new PopupOption <string>(globalClock.key));
            }
        }

        PopupOption <string> selectedOption;

        if (options.Any(o => o.value == property.stringValue))
        {
            selectedOption = new PopupOption <string>(property.stringValue);
        }
        else if (!string.IsNullOrEmpty(property.stringValue))
        {
            selectedOption = new PopupOption <string>(property.stringValue, property.stringValue + " (Missing)");
        }
        else
        {
            selectedOption = null;
        }

        PopupOption <string> noneOption = new PopupOption <string>(null, "None");

        var currentProperty = property;

        position = EditorGUI.PrefixLabel(position, label);

        PopupGUI <string> .Render
        (
            position,
            gc => ChangeValue(currentProperty, gc),
            options,
            selectedOption,
            noneOption,
            property.hasMultipleDifferentValues
        );

        EditorGUI.EndProperty();
    }
 private void Start()
 {
     m_path            = new NavMeshPath();
     m_client          = (LidClient)UnityEngine.Object.FindObjectOfType(typeof(LidClient));
     m_inventory       = (InventoryGUI)UnityEngine.Object.FindObjectOfType(typeof(InventoryGUI));
     m_communicator    = (QmunicatorGUI)UnityEngine.Object.FindObjectOfType(typeof(QmunicatorGUI));
     m_itemGui         = (ItemGUI)UnityEngine.Object.FindObjectOfType(typeof(ItemGUI));
     m_popupGui        = (PopupGUI)UnityEngine.Object.FindObjectOfType(typeof(PopupGUI));
     m_repairNpcs      = (RepairingNpc[])UnityEngine.Object.FindObjectsOfType(typeof(RepairingNpc));
     m_tooltipText     = m_tooltip.GetComponentInChildren <TextMesh>();
     m_tooltipHudRText = m_tooltipHudR.GetComponentInChildren <TextMesh>();
     m_tooltipHudLText = m_tooltipHudL.GetComponentInChildren <TextMesh>();
     ResetTarget();
     m_buySellPos = m_invalidPos;
 }
示例#5
0
 private void SendAuth()
 {
     if (m_client != null && m_client.ConnectionStatus == NetConnectionStatus.Connected && m_serverCon != null)
     {
         m_chat         = (ComChatGUI)Object.FindObjectOfType(typeof(ComChatGUI));
         m_inventory    = (InventoryGUI)Object.FindObjectOfType(typeof(InventoryGUI));
         m_hud          = (Hud)Object.FindObjectOfType(typeof(Hud));
         m_map          = (MapGUI)Object.FindObjectOfType(typeof(MapGUI));
         m_partyGui     = (PartyGUI)Object.FindObjectOfType(typeof(PartyGUI));
         m_popupGui     = (PopupGUI)Object.FindObjectOfType(typeof(PopupGUI));
         m_clientInput  = (ClientInput)Object.FindObjectOfType(typeof(ClientInput));
         m_missionObjs  = (MissionObjective[])Object.FindObjectsOfType(typeof(MissionObjective));
         m_specialAreas = (SpecialArea[])Object.FindObjectsOfType(typeof(SpecialArea));
         Debug.Log("Connected to server ... loading level complete ... send AUTH at " + Time.time);
         NetOutgoingMessage netOutgoingMessage = m_serverCon.Peer.CreateMessage();
         netOutgoingMessage.Write(MessageIds.Auth);
         netOutgoingMessage.Write(m_name);
         netOutgoingMessage.Write(m_pwhash);
         netOutgoingMessage.Write(m_id);
         netOutgoingMessage.Write("1.0.1");
         netOutgoingMessage.Write((byte)PlayerPrefs.GetInt("prefAppearance", 0));
         m_serverCon.SendMessage(netOutgoingMessage, NetDeliveryMethod.ReliableOrdered, 1);
     }
 }
示例#6
0
 void OnTriggerEnter()
 {
     PopupGUI.Popup(message);
     GetComponent <Collider>().enabled = false;
 }
示例#7
0
        /// <inheritdoc />
        protected override void RenderMemberControl(Rect position)
        {
            // Other Targets
            // Some Unity Objects, like Assets, are not supported by the drawer.
            // Just display an error message to let the user change their target.

            if (targetType == UnityObjectType.Other)
            {
                EditorGUI.HelpBox(position, "Unsupported Unity Object type.", MessageType.None);
                return;
            }

            // Display a list of all available reflected members in a popup.

            var options = new List <PopupOption <TMember> >();

            TMember value = GetValue();

            PopupOption <TMember> selectedOption = null;
            PopupOption <TMember> noneOption     = new PopupOption <TMember>(null, string.Format("No {0}", memberLabel));

            if (targetType == UnityObjectType.GameObject)
            {
                // Check if all targets have a GameObject (none are empty).
                // If they do, display all members of the GameObject type.

                if (HasSharedGameObject())
                {
                    var gameObjectOptions = GetMemberOptions(typeof(GameObject));

                    foreach (var gameObjectOption in gameObjectOptions)
                    {
                        // Prefix label by GameObject for popup clarity.

                        gameObjectOption.label = string.Format("GameObject/{0}", gameObjectOption.label);

                        options.Add(gameObjectOption);
                    }
                }

                // Find all shared component types across targets.
                // Display all members of each one found.

                foreach (Type componentType in GetSharedComponentTypes())
                {
                    var componentOptions = GetMemberOptions(componentType, componentType.Name);

                    foreach (var componentOption in componentOptions)
                    {
                        // Prefix label and option by component type for clear distinction.

                        componentOption.label = string.Format("{0}/{1}", componentType.Name, componentOption.label);

                        options.Add(componentOption);
                    }
                }

                // Determine which option is currently selected.

                if (value != null)
                {
                    string label;

                    if (value.component == null)
                    {
                        label = string.Format("GameObject.{0}", value.name);
                    }
                    else
                    {
                        label = string.Format("{0}.{1}", value.component, value.name);
                    }

                    UnityMethod method = value as UnityMethod;

                    if (method != null)
                    {
                        string parameterString = string.Join(", ", method.parameterTypes.Select(t => t.PrettyName()).ToArray());

                        label += string.Format(" ({0})", parameterString);
                    }

                    TMember valueInOptions = options.Select(option => option.value).FirstOrDefault(member => member.Corresponds(value));

                    if (valueInOptions != null)
                    {
                        selectedOption = new PopupOption <TMember>(valueInOptions, label);
                    }
                    else
                    {
                        selectedOption = new PopupOption <TMember>(value, label);
                    }
                }
            }
            else if (targetType == UnityObjectType.ScriptableObject)
            {
                // ScriptableObject Target
                // Make sure all targets share the same ScriptableObject Type.
                // If they do, display all members of that type.

                Type scriptableObjectType = GetSharedScriptableObjectType();

                if (scriptableObjectType != null)
                {
                    options.AddRange(GetMemberOptions(scriptableObjectType));

                    // Determine which option is currently selected.

                    if (value != null)
                    {
                        selectedOption = options.Find(o => o.value.Corresponds(value));

                        if (selectedOption == null)
                        {
                            selectedOption = new PopupOption <TMember>(value, value.name);
                        }
                    }
                }
            }

            // Make sure the callback uses the property of this drawer, not at its later value.
            var propertyNow = property;

            bool enabled = targetType != UnityObjectType.None;

            if (!enabled)
            {
                EditorGUI.BeginDisabledGroup(true);
            }

            PopupGUI <TMember> .Render
            (
                position,
                newValue =>
            {
                Update(propertyNow);
                SetValue(newValue);
                propertyNow.serializedObject.ApplyModifiedProperties();
            },
                options,
                selectedOption,
                noneOption,
                hasMultipleDifferentValues
            );

            if (!enabled)
            {
                EditorGUI.EndDisabledGroup();
            }
        }
示例#8
0
 void Awake()
 {
     instance = this;
     enabled  = false;
 }