public void shuttleFlightClicked()
    {
        // check if player is in a city with a research station
        GameObject myPlayer    = GameObject.Find("_NetworkManager").GetComponent <PlayerNetwork>().myPawn;
        string     curCityName = myPlayer.GetComponent <PlayerMovement>().TargetParent;
        GameObject curCity     = GameObject.Find(curCityName);

        // check if player has its current city cityCard and init button
        if (curCity.GetComponent <City>().hasRS())
        {
            GameObject[] cities = GameObject.FindGameObjectsWithTag("City");
            foreach (GameObject city in cities)
            {
                if (city.GetComponent <City>().hasRS())
                {
                    UIButton                button  = city.GetComponent <UIButton>();
                    EventDelegate           onclick = new EventDelegate(GameObject.Find("ActionManager").GetComponent <ShuttleFlight>(), "takeShuttleFlight");
                    EventDelegate.Parameter param   = new EventDelegate.Parameter();
                    param.value           = button;
                    param.expectedType    = button.GetType();
                    onclick.parameters[0] = param;

                    EventDelegate.Add(button.onClick, onclick);
                }
            }
        }
    }
Beispiel #2
0
    public void directFlightClicked()
    {
        // init the cityCard in hands button
        GameObject hand = GameObject.Find("PlayerHand/Scroll View/Grid");

        foreach (Transform card in hand.transform)
        {
            if (card.tag == "CityCard")
            {
                foreach (Transform sprite in card.transform)
                {
                    UIButton                button  = sprite.GetComponent <UIButton>();
                    EventDelegate           onclick = new EventDelegate(GameObject.Find("ActionManager").GetComponent <DirectFlight>(), "takeDirectFlight");
                    EventDelegate.Parameter param   = new EventDelegate.Parameter();
                    EventDelegate.Parameter param2  = new EventDelegate.Parameter();
                    param.value           = card.GetComponent <CityCards>().getCity();
                    param2.value          = card.name;
                    param.expectedType    = card.GetComponent <CityCards>().getCity().GetType();
                    param2.expectedType   = card.name.GetType();
                    onclick.parameters[0] = param;
                    onclick.parameters[1] = param2;

                    EventDelegate.Add(button.onClick, onclick);
                }
            }
        }
    }
Beispiel #3
0
    public void charterFlightClicked()
    {
        GameObject hand     = GameObject.Find("PlayerHand/Scroll View/Grid");
        GameObject myPlayer = GameObject.Find("_NetworkManager").GetComponent <PlayerNetwork>().myPawn;

        // check if player has its current city cityCard
        foreach (Transform card in hand.transform)
        {
            if (card.tag == "CityCard" && card.GetComponent <CityCards>().getCity().name.Equals(myPlayer.GetComponent <PlayerMovement>().TargetParent))
            {
                // init every city button
                GameObject[] cities = GameObject.FindGameObjectsWithTag("City");
                foreach (GameObject city in cities)
                {
                    UIButton                button  = city.GetComponent <UIButton>();
                    EventDelegate           onclick = new EventDelegate(GameObject.Find("ActionManager").GetComponent <CharterFlight>(), "takeCharterFlight");
                    EventDelegate.Parameter param   = new EventDelegate.Parameter();
                    param.value           = button;
                    param.expectedType    = button.GetType();
                    onclick.parameters[0] = param;
                    EventDelegate.Parameter param2 = new EventDelegate.Parameter();
                    param2.value          = card.name;
                    param2.expectedType   = card.name.GetType();
                    onclick.parameters[1] = param2;

                    EventDelegate.Add(button.onClick, onclick);
                }
            }
        }
    }
Beispiel #4
0
        private void ShowCharacter(Character obj)
        {
            if (obj != null)
            {
                obj.SetIsShowing(true);
                obj.SetIsHited(false);

                Vector3 posToTween = new Vector3(0, 0, 0);

                string[] charPosition = obj.GetComponent <Character>().name.Split(char.Parse("_"));
                switch (charPosition[0])
                {
                case "left":
                    posToTween = new Vector3(obj.GetInitialPosition().x + _distToTween, obj.GetInitialPosition().y, obj.GetInitialPosition().z);
                    break;

                case "center":
                    posToTween = new Vector3(obj.GetInitialPosition().x, obj.GetInitialPosition().y + _distToTween, obj.GetInitialPosition().z);
                    break;

                case "right":
                    posToTween = new Vector3(obj.GetInitialPosition().x - _distToTween, obj.GetInitialPosition().y, obj.GetInitialPosition().z);
                    break;
                }

                TweenPosition objTween = TweenPosition.Begin(obj.gameObject, _timeInTween, posToTween);

                EventDelegate.Parameter objToApplyTween = new EventDelegate.Parameter();
                objToApplyTween.obj = obj.gameObject;

                EventDelegate del = new EventDelegate(this, "CompleteShowTween");
                del.parameters.SetValue(objToApplyTween, 0);
                EventDelegate.Add(objTween.onFinished, del);
            }
        }
Beispiel #5
0
    public unsafe override void Unity_NamedDeserialize(int depth)
    {
        byte[] var_0_cp_0;
        int    var_0_cp_1;

        if (depth <= 7)
        {
            ISerializedNamedStateReader arg_1E_0 = SerializedNamedStateReader.Instance;
            var_0_cp_0   = $FieldNamesStorage.$RuntimeNames;
            var_0_cp_1   = 0;
            this.mTarget = (arg_1E_0.ReadUnityEngineObject(&var_0_cp_0[var_0_cp_1] + 2225) as MonoBehaviour);
        }
        this.mMethodName = (SerializedNamedStateReader.Instance.ReadString(&var_0_cp_0[var_0_cp_1] + 2233) as string);
        if (depth <= 7)
        {
            this.mParameters = new EventDelegate.Parameter[SerializedNamedStateReader.Instance.BeginSequenceGroup(&var_0_cp_0[var_0_cp_1] + 2245)];
            for (int i = 0; i < this.mParameters.Length; i++)
            {
                this.mParameters[i] = new EventDelegate.Parameter();
                EventDelegate.Parameter arg_99_0 = this.mParameters[i];
                SerializedNamedStateReader.Instance.BeginMetaGroup((IntPtr)0);
                arg_99_0.Unity_NamedDeserialize(depth + 1);
                SerializedNamedStateReader.Instance.EndMetaGroup();
            }
            SerializedNamedStateReader.Instance.EndMetaGroup();
        }
        this.oneShot = SerializedNamedStateReader.Instance.ReadBoolean(&var_0_cp_0[var_0_cp_1] + 2257);
        SerializedNamedStateReader.Instance.Align();
    }
    // GiveCard button clicked
    public void GiveCardClicked()
    {
        Debug.Log("GiveCardClicked");
        // Store the player's hand
        GameObject hand = GameObject.Find("PlayerHand/Scroll View/Grid");

        // Set up events for cards in hand (make them clickable)
        foreach (Transform card in hand.transform)
        {
            if (card.tag == "CityCard")
            {
                foreach (Transform sprite in card.transform)
                {
                    UIButton                button  = sprite.GetComponent <UIButton>();
                    EventDelegate           onClick = new EventDelegate(GameObject.Find("ActionManager").GetComponent <ShareKnowledge>(), "giveACard");
                    EventDelegate.Parameter param1  = new EventDelegate.Parameter();
                    EventDelegate.Parameter param2  = new EventDelegate.Parameter();

                    param1.value = card.name;
                    param2.value = GameObject.Find("_NetworkManager").GetComponent <PlayerNetwork>().myPawn.GetComponent <PhotonView>().ownerId;

                    param1.expectedType = card.GetComponent <CityCards>().getCity().GetType();
                    param2.expectedType = GameObject.Find("_NetworkManager").GetComponent <PlayerNetwork>().myPawn.GetComponent <PhotonView>().ownerId.GetType();

                    onClick.parameters[0] = param1;     // Name of card to give
                    onClick.parameters[1] = param2;     // Name of giving player

                    EventDelegate.Add(button.onClick, onClick);
                }
            }
        }
    }
Beispiel #7
0
    public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
    {
        SerializedProperty targetProp = prop.FindPropertyRelative("mTarget");

        if (targetProp.objectReferenceValue == null)
        {
            return(2 * lineHeight);
        }
        int lines = 3 * lineHeight;

        SerializedProperty methodProp = prop.FindPropertyRelative("mMethodName");

        EventDelegate del = new EventDelegate();

        del.target     = targetProp.objectReferenceValue as MonoBehaviour;
        del.methodName = methodProp.stringValue;
        EventDelegate.Parameter[] ps = del.parameters;

        if (ps != null)
        {
            for (int i = 0; i < ps.Length; ++i)
            {
                lines += lineHeight;
                EventDelegate.Parameter param = ps[i];
                if (param.obj != null)
                {
                    lines += lineHeight;
                }
            }
        }
        return(lines);
    }
Beispiel #8
0
	public void SetToggleChange()
	{
		toggle = GetComponent<UIToggle>();
		EventDelegate toggleDelegate = new EventDelegate (commentsWindow, "CommentToggleChange");
		EventDelegate.Parameter parameter = new EventDelegate.Parameter(this);
		toggleDelegate.parameters[0] = parameter;
		toggle.onChange.Add(toggleDelegate);
	}
    // Need to show cards
    private void takeACard(int playerRequesting, GameObject playerGivingPermission)
    {
        Debug.Log("takeACard with playerRequestion = " + playerRequesting + " playerGivingPermission = " + playerGivingPermission.GetPhotonView().ownerId);
        // Show the Panel

        GameObject    panel = Instantiate(prefabTakePanel);
        List <string> hand  = playerGivingPermission.GetComponent <PlayerMovement> ().myHand;

        UIGrid grid = GameObject.Find("TakeCardPanel(Clone)/panel/Scroll View/Grid").GetComponent <UIGrid>();

        foreach (string card in hand)
        {
            Debug.Log("Player has " + card);
            GameObject cardObject = GameObject.Find(card);
            GameObject go         = NGUITools.AddChild(grid.gameObject, cardObject);
            grid.AddChild(go.transform);
        }

        // Set up events for cards in hand (make them clickable)
        foreach (Transform card in grid.transform)
        {
            if (card.tag == "CityCard")
            {
                foreach (Transform sprite in card.transform)
                {
                    UIButton                button  = sprite.GetComponent <UIButton>();
                    EventDelegate           onClick = new EventDelegate(GameObject.Find("ActionManager").GetComponent <ShareKnowledge>(), "sendRequest");
                    EventDelegate.Parameter param1  = new EventDelegate.Parameter();
                    EventDelegate.Parameter param2  = new EventDelegate.Parameter();
                    EventDelegate.Parameter param3  = new EventDelegate.Parameter();
                    EventDelegate.Parameter param4  = new EventDelegate.Parameter();
                    EventDelegate.Parameter param5  = new EventDelegate.Parameter();

                    param1.value = card.name;
                    param2.value = playerRequesting;                            // int
                    param3.value = "Take";
                    param4.value = playerGivingPermission;
                    param5.value = PhotonNetwork.player.ID;

                    param1.expectedType = card.GetType();
                    param2.expectedType = playerRequesting.GetType();
                    param3.expectedType = ("Take").GetType();
                    param4.expectedType = playerGivingPermission.GetType();
                    param5.expectedType = PhotonNetwork.player.ID.GetType();

                    onClick.parameters[0] = param1;
                    onClick.parameters[1] = param2;
                    onClick.parameters[2] = param3;
                    onClick.parameters[3] = param4;
                    onClick.parameters[4] = param5;

                    EventDelegate.Add(button.onClick, onClick);
                }
            }
        }
    }
Beispiel #10
0
 // 이벤트 parameter를 생성하여 리턴.
 private EventDelegate.Parameter MakeParameter(Object _value, System.Type _type)
 {
     EventDelegate.Parameter param = new EventDelegate.Parameter();
     // 이벤트 parameter 생성.
     param.obj = _value;
     // 이벤트 함수에 전달하고 싶은 값.
     param.expectedType = _type;
     // 값의 타입.
     return(param);
 }
Beispiel #11
0
 public static EventDelegate.Parameter MakeParameter(UnityEngine.Object _value, System.Type _type)
 {
     EventDelegate.Parameter param = new EventDelegate.Parameter();
     // 이벤트 parameter 생성.
     param.obj = _value;
     // 이벤트 함수에 전달하고 싶은 값.
     param.expectedType = _type;
     // 값의 타입.
     return(param);
 }
Beispiel #12
0
    static public void AddOnEvent(MonoBehaviour target, List <EventDelegate> list, string method, object value, System.Type type)
    {
        EventDelegate onClickEvent = new EventDelegate(target, method);

        EventDelegate.Parameter param = new EventDelegate.Parameter();
        param.value                = value;
        param.expectedType         = type;
        onClickEvent.parameters[0] = param;

        EventDelegate.Add(list, onClickEvent);
    }
Beispiel #13
0
    public static EventDelegate CreateEventDelegate(MonoBehaviour target, string methodName, object parameter)
    {
        EventDelegate eventDelegate = new EventDelegate(target, methodName);

        if (parameter != null)
        {
            EventDelegate.Parameter parameter2 = eventDelegate.parameters[0];
            parameter2.value = parameter;
        }
        return(eventDelegate);
    }
Beispiel #14
0
    public void Set_ButtonCharaterDetailedInfo(UIButton button, int charater_index)
    {
        EventDelegate.Parameter param = new EventDelegate.Parameter();

        param.value        = charater_index;
        param.expectedType = typeof(int);

        EventDelegate onClick = new EventDelegate(CharaterDetailedInfo.GetComponent <Charater_DetailedInfo_Action>(), "Set_Charater_DetailedInfo");

        onClick.parameters[0] = param;
        EventDelegate.Add(button.onClick, onClick);
    }
Beispiel #15
0
 static public int get_field(IntPtr l)
 {
     try {
         EventDelegate.Parameter self = (EventDelegate.Parameter)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.field);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 void Start()
 {
     UIMRoot = GameObject.Find("UI Manager").GetComponent<UIManager>();
     EventDelegate.Add(Back.onClick, UIMRoot.gotoStagelist);
         EventDelegate.Parameter param1 = new EventDelegate.Parameter();
         param1.obj = gameObject.GetComponent<GameReadyPanel>();
         param1.field = "questnum";
         EventDelegate SetOn = new EventDelegate(GameObject.Find("GameManager").GetComponent<GameManager>(), "GotoStage");
         SetOn.parameters[0] = param1;
         EventDelegate.Add(gameObject.transform.FindChild("InformationPanel").FindChild("GameStartButton").GetComponent<UIEventTrigger>().onClick, SetOn);
        
 }
Beispiel #17
0
    public void Set_BuyButton(UIButton button)
    {
        EventDelegate.Parameter param = new EventDelegate.Parameter();

        param.obj   = button.gameObject.transform.parent.GetComponent <ItemInfo_Action>();
        param.field = "ID";

        EventDelegate onClick = new EventDelegate(gameObject.GetComponent <StoreManager>(), "Buy_Item");

        onClick.parameters[0] = param;

        EventDelegate.Add(button.onClick, onClick);
    }
Beispiel #18
0
    void Start()
    {
        UIMRoot = GameObject.Find("UI Manager").GetComponent<UIManager>();
        questnum = 1000;
        EventDelegate.Add(Back.onClick, UIMRoot.gotoLobby);

        EventDelegate.Parameter param1 = new EventDelegate.Parameter();
        param1.obj = gameObject.GetComponent<MuhanPanel>();
        param1.field = "questnum";
        EventDelegate SetOn = new EventDelegate(GameObject.Find("GameManager").GetComponent<GameManager>(), "GotoStage");
        SetOn.parameters[0] = param1;
        EventDelegate.Add(Startb.onClick, SetOn);
    }
Beispiel #19
0
    void Set_ChangeEquipmentButton(UIButton button)
    {
        EventDelegate.Parameter param = new EventDelegate.Parameter();

        param.obj   = button.gameObject.transform.GetComponent <SelectEquipmentInfo_Action>();
        param.field = "ID";

        EventDelegate onClick = new EventDelegate(gameObject.GetComponent <Select_CharaterEquipment_Action>(), "Select_Equipment");

        onClick.parameters[0] = param;

        EventDelegate.Add(button.onClick, onClick);
    }
Beispiel #20
0
 static public int set_field(IntPtr l)
 {
     try {
         EventDelegate.Parameter self = (EventDelegate.Parameter)checkSelf(l);
         System.String           v;
         checkType(l, 2, out v);
         self.field = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Beispiel #21
0
 static public int set_propInfo(IntPtr l)
 {
     try {
         EventDelegate.Parameter        self = (EventDelegate.Parameter)checkSelf(l);
         System.Reflection.PropertyInfo v;
         checkType(l, 2, out v);
         self.propInfo = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Beispiel #22
0
 static public int set_obj(IntPtr l)
 {
     try {
         EventDelegate.Parameter self = (EventDelegate.Parameter)checkSelf(l);
         UnityEngine.Object      v;
         checkType(l, 2, out v);
         self.obj = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Beispiel #23
0
    public static List <EventDelegate> CreateEventDelegateList(MonoBehaviour target, string methodName, object parameter)
    {
        List <EventDelegate> list          = new List <EventDelegate>();
        EventDelegate        eventDelegate = new EventDelegate();

        eventDelegate.target     = target;
        eventDelegate.methodName = methodName;
        list.Add(eventDelegate);
        if (parameter != null)
        {
            EventDelegate.Parameter parameter2 = eventDelegate.parameters[0];
            parameter2.value = parameter;
        }
        return(list);
    }
Beispiel #24
0
    public void SetFlowerPreFab(int x)
    {
        //------------------------
        // Instantiate Prefab
        //------------------------
        GameObject FlowerClone = Instantiate(FlowerPrefab) as GameObject;

        FlowerClone.name                    = "Flower" + x;
        FlowerClone.tag                     = "Flower";
        FlowerClone.transform.parent        = gameState.Grid.transform;
        FlowerClone.transform.localPosition = new Vector3(FlowerPosX(x), flowerPosY, 0f);
        FlowerClone.transform.localScale    = Vector3.one * g.scaleRatio;
        gameComponent.SetFlowerPrefab(FlowerClone.transform);

        //------------------------
        // Event key
        //------------------------
        EventDelegate eventClick = new EventDelegate(this, "EventFlowerOnPress");

        EventDelegate.Parameter param = new EventDelegate.Parameter();
        param.obj                = FlowerClone.transform;
        param.expectedType       = typeof(Transform);
        eventClick.parameters[0] = param;
        EventDelegate.Add(gameComponent.flowerUIEventTrigger.onPress, eventClick);

        //------------------------
        // Initiate spriteName
        //------------------------
        gameComponent.flowerUISprite.spriteName = "flower_ani001";
        //gameComponent.flowerUISprite.MakePixelPerfect();

        //------------------------
        // set flower's array
        //------------------------
        flowerSprite[x]    = gameComponent.flowerUISprite;
        flowerTransform[x] = FlowerClone.transform;

        flowerSweatSprite[x] = gameComponent.flowerSweatUISprite;

        flowerSweatAnimator[x] = gameComponent.flowerSweatAnimator;
        flowerAnimator[x]      = gameComponent.flowerAnimator;
    }
Beispiel #25
0
    public void driveClicked()
    {
        // init the neighbours button
        GameObject        myPlayer    = GameObject.Find("_NetworkManager").GetComponent <PlayerNetwork>().myPawn;
        string            curCityName = myPlayer.GetComponent <PlayerMovement>().TargetParent;
        GameObject        curCity     = GameObject.Find(curCityName);
        List <GameObject> neighbours  = curCity.GetComponent <City>().adjacentCityList;

        foreach (GameObject neighbour in neighbours)
        {
            UIButton                button  = neighbour.GetComponent <UIButton>();
            EventDelegate           onclick = new EventDelegate(GameObject.Find("ActionManager").GetComponent <Drive>(), "driveTo");
            EventDelegate.Parameter param   = new EventDelegate.Parameter();
            param.value           = button;
            param.expectedType    = button.GetType();
            onclick.parameters[0] = param;

            EventDelegate.Add(button.onClick, onclick);
        }
    }
Beispiel #26
0
    public void SetBowGunPreFab(int x, int y)
    {
        //------------------------
        // Instantiate Prefab
        //------------------------
        GameObject bowGunPrefab = Instantiate(BowGunPrefab) as GameObject;

        bowGunPrefab.name = "Bow" + x + y;

        //arrowGunPrefab.tag = x == 0 ? "ArrowLeft" : "ArrowRight";
        bowGunPrefab.tag = "Bow";
        bowGunPrefab.transform.parent        = gameState.Grid.transform;
        bowGunPrefab.transform.localPosition = new Vector3((x * g.tileWidth * 1.3f) + 82
                                                           , (y * -g.tileHeight) + 70
                                                           , 0f);
        bowGunPrefab.transform.localScale = Vector3.one;
        gameComponent.SetBowPrefab(bowGunPrefab.transform);

        //------------------------
        // Event key
        //------------------------
        EventDelegate eventClick = new EventDelegate(this, "EventBowOnPress");

        EventDelegate.Parameter param = new EventDelegate.Parameter();
        param.obj                = bowGunPrefab.transform;
        param.expectedType       = typeof(Transform);
        eventClick.parameters[0] = param;
        EventDelegate.Add(gameComponent.bowUIEventTrigger.onPress, eventClick);

        //------------------------
        // array arrowSprite
        //------------------------
        gameComponent.bowUISprite.spriteName = "arrow4";
        //gameComponent.bowUISprite.MakePixelPerfect();

        g.bowSprite[x] = gameComponent.bowUISprite;
        g.bowBox[x]    = gameComponent.bowBoxcollider;
        //Debug.Log("g.arrowBox.Length="+g.bowBox.Length);
    }
    // TakeCard button clicked
    public void TakeCardClicked()
    {
        // Set up events for Pawn
        Debug.Log("TakeCardClicked");
        // Get all the pawns in game
        GameObject[] pawns = GameObject.FindGameObjectsWithTag("Pawn");
        // Get MY pawn
        GameObject myPawn = GameObject.Find("_NetworkManager").GetComponent <PlayerNetwork>().myPawn;

        // Put events on them
        foreach (GameObject pawn in pawns)
        {
            //if (pawn.GetPhotonView().ownerId == gameObject.GetPhotonView().ownerId) {
            if (pawn == myPawn)
            {
                Debug.Log("MyPawn");
                UIButton pawnButton = pawn.GetComponent <UIButton>();
                pawnButton.onClick.Clear();
                continue;
            }
            UIButton                button  = pawn.GetComponent <UIButton> ();
            EventDelegate           onClick = new EventDelegate(GameObject.Find("ActionManager").GetComponent <ShareKnowledge> (), "takeACard");
            EventDelegate.Parameter param1  = new EventDelegate.Parameter();
            EventDelegate.Parameter param2  = new EventDelegate.Parameter();

            // Send the player who wants to take
            // Send the player who needs to give
            param1.value = GameObject.Find("_NetworkManager").GetComponent <PlayerNetwork>().myPawn.GetComponent <PhotonView>().ownerId;
            param2.value = pawn;

            param1.expectedType = GameObject.Find("_NetworkManager").GetComponent <PlayerNetwork>().myPawn.GetComponent <PhotonView>().ownerId.GetType();
            param2.expectedType = pawn.GetType();

            onClick.parameters[0] = param1;
            onClick.parameters[1] = param2;

            EventDelegate.Add(button.onClick, onClick);
        }
    }
Beispiel #28
0
        public void HideCharacter(Character obj)
        {
            if (obj != null)
            {
                Debug.Log("[ CHARACTER_MANAGER ] - HIDE_CHARACTER");
                Vector3 posToTween = new Vector3(0, 0, 0);

                obj.SetIsShowing(false);
                obj.SetIsHited(false);

                posToTween = obj.GetInitialPosition();

                TweenPosition objTween = TweenPosition.Begin(obj.gameObject, _timeInTween, posToTween);

                EventDelegate.Parameter objToApplyTween = new EventDelegate.Parameter();
                objToApplyTween.obj = obj.gameObject;

                EventDelegate del = new EventDelegate(this, "CompleteHideTween");
                del.parameters.SetValue(objToApplyTween, 0);
                EventDelegate.Add(objTween.onFinished, del);
            }
        }
Beispiel #29
0
 static public int constructor(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         EventDelegate.Parameter o;
         if (argc == 1)
         {
             o = new EventDelegate.Parameter();
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (argc == 3)
         {
             UnityEngine.Object a1;
             checkType(l, 2, out a1);
             System.String a2;
             checkType(l, 3, out a2);
             o = new EventDelegate.Parameter(a1, a2);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (argc == 2)
         {
             System.Object a1;
             checkType(l, 2, out a1);
             o = new EventDelegate.Parameter(a1);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         return(error(l, "New object failed."));
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Beispiel #30
0
    public unsafe override void Unity_NamedSerialize(int depth)
    {
        byte[] var_0_cp_0;
        int    var_0_cp_1;

        if (depth <= 7)
        {
            ISerializedNamedStateWriter arg_23_0 = SerializedNamedStateWriter.Instance;
            UnityEngine.Object          arg_23_1 = this.mTarget;
            var_0_cp_0 = $FieldNamesStorage.$RuntimeNames;
            var_0_cp_1 = 0;
            arg_23_0.WriteUnityEngineObject(arg_23_1, &var_0_cp_0[var_0_cp_1] + 2225);
        }
        SerializedNamedStateWriter.Instance.WriteString(this.mMethodName, &var_0_cp_0[var_0_cp_1] + 2233);
        if (depth <= 7)
        {
            if (this.mParameters == null)
            {
                SerializedNamedStateWriter.Instance.BeginSequenceGroup(&var_0_cp_0[var_0_cp_1] + 2245, 0);
                SerializedNamedStateWriter.Instance.EndMetaGroup();
            }
            else
            {
                SerializedNamedStateWriter.Instance.BeginSequenceGroup(&var_0_cp_0[var_0_cp_1] + 2245, this.mParameters.Length);
                for (int i = 0; i < this.mParameters.Length; i++)
                {
                    EventDelegate.Parameter arg_C0_0 = (this.mParameters[i] != null) ? this.mParameters[i] : new EventDelegate.Parameter();
                    SerializedNamedStateWriter.Instance.BeginMetaGroup((IntPtr)0);
                    arg_C0_0.Unity_NamedSerialize(depth + 1);
                    SerializedNamedStateWriter.Instance.EndMetaGroup();
                }
                SerializedNamedStateWriter.Instance.EndMetaGroup();
            }
        }
        SerializedNamedStateWriter.Instance.WriteBoolean(this.oneShot, &var_0_cp_0[var_0_cp_1] + 2257);
        SerializedNamedStateWriter.Instance.Align();
    }
Beispiel #31
0
    /// <summary>
    /// Draw an editor field for the Unity Delegate.
    /// </summary>

    static public bool Field(Object undoObject, EventDelegate del, bool removeButton, bool minimalistic)
    {
        if (del == null)
        {
            return(false);
        }
        bool prev = GUI.changed;

        GUI.changed = false;
        bool          retVal = false;
        MonoBehaviour target = del.target;
        bool          remove = false;

        if (removeButton && (del.target != null || del.isValid))
        {
            if (!minimalistic)
            {
                NGUIEditorTools.SetLabelWidth(82f);
            }

            if (del.target == null && del.isValid)
            {
                EditorGUILayout.LabelField("Notify", del.ToString());
            }
            else
            {
                target = EditorGUILayout.ObjectField("Notify", del.target, typeof(MonoBehaviour), true) as MonoBehaviour;
            }

            GUILayout.Space(-18f);
            GUILayout.BeginHorizontal();
            GUILayout.Space(70f);

            if (GUILayout.Button("", "ToggleMixed", GUILayout.Width(20f), GUILayout.Height(16f)))
            {
                target = null;
                remove = true;
            }
            GUILayout.EndHorizontal();
        }
        else
        {
            target = EditorGUILayout.ObjectField("Notify", del.target, typeof(MonoBehaviour), true) as MonoBehaviour;
        }

        if (remove)
        {
            NGUIEditorTools.RegisterUndo("Delegate Selection", undoObject);
            del.Clear();
            EditorUtility.SetDirty(undoObject);
        }
        else if (del.target != target)
        {
            NGUIEditorTools.RegisterUndo("Delegate Selection", undoObject);
            del.target = target;
            EditorUtility.SetDirty(undoObject);
        }

        if (del.target != null && del.target.gameObject != null)
        {
            GameObject   go   = del.target.gameObject;
            List <Entry> list = GetMethods(go);

            int      index  = 0;
            string[] names  = PropertyReferenceDrawer.GetNames(list, del.ToString(), out index);
            int      choice = 0;

            GUILayout.BeginHorizontal();
            choice = EditorGUILayout.Popup("Method", index, names);
            NGUIEditorTools.DrawPadding();
            GUILayout.EndHorizontal();

            if (choice > 0 && choice != index)
            {
                Entry entry = list[choice - 1];
                NGUIEditorTools.RegisterUndo("Delegate Selection", undoObject);
                del.target     = entry.target as MonoBehaviour;
                del.methodName = entry.name;
                EditorUtility.SetDirty(undoObject);
                retVal = true;
            }

            GUI.changed = false;
            EventDelegate.Parameter[] ps = del.parameters;

            if (ps != null)
            {
                for (int i = 0; i < ps.Length; ++i)
                {
                    EventDelegate.Parameter param = ps[i];
                    Object obj = EditorGUILayout.ObjectField("   Arg " + i, param.obj, typeof(Object), true);

                    if (GUI.changed)
                    {
                        GUI.changed = false;
                        param.obj   = obj;
                        EditorUtility.SetDirty(undoObject);
                    }

                    if (obj == null)
                    {
                        continue;
                    }

                    GameObject  selGO = null;
                    System.Type type  = obj.GetType();
                    if (type == typeof(GameObject))
                    {
                        selGO = obj as GameObject;
                    }
                    else if (type.IsSubclassOf(typeof(Component)))
                    {
                        selGO = (obj as Component).gameObject;
                    }

                    if (selGO != null)
                    {
                        // Parameters must be exact -- they can't be converted like property bindings
                        PropertyReferenceDrawer.filter     = param.expectedType;
                        PropertyReferenceDrawer.canConvert = false;
                        List <PropertyReferenceDrawer.Entry> ents = PropertyReferenceDrawer.GetProperties(selGO, true, false);

                        int      selection;
                        string[] props = GetNames(ents, NGUITools.GetFuncName(param.obj, param.field), out selection);

                        GUILayout.BeginHorizontal();
                        int newSel = EditorGUILayout.Popup(" ", selection, props);
                        NGUIEditorTools.DrawPadding();
                        GUILayout.EndHorizontal();

                        if (GUI.changed)
                        {
                            GUI.changed = false;

                            if (newSel == 0)
                            {
                                param.obj   = selGO;
                                param.field = null;
                            }
                            else
                            {
                                param.obj   = ents[newSel - 1].target;
                                param.field = ents[newSel - 1].name;
                            }
                            EditorUtility.SetDirty(undoObject);
                        }
                    }
                    else if (!string.IsNullOrEmpty(param.field))
                    {
                        param.field = null;
                        EditorUtility.SetDirty(undoObject);
                    }

                    PropertyReferenceDrawer.filter     = typeof(void);
                    PropertyReferenceDrawer.canConvert = true;
                }
            }
        }
        else
        {
            retVal = GUI.changed;
        }
        GUI.changed = prev;
        return(retVal);
    }
    public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
    {
        SerializedProperty showGroup = prop.FindPropertyRelative("mShowGroup");

        if (!showGroup.boolValue)
        {
            return(lineHeight);
        }

        float lines = (3 * lineHeight);

        SerializedProperty targetProp = prop.FindPropertyRelative("mTarget");

        if (targetProp.objectReferenceValue == null)
        {
            return(lines);
        }

        lines += lineHeight;

        SerializedProperty methodProp = prop.FindPropertyRelative("mMethodName");

        if (methodProp.stringValue == "<Choose>" || methodProp.stringValue.StartsWith("<Missing - "))
        {
            return(lines);
        }

        eventDelegate.target     = targetProp.objectReferenceValue;
        eventDelegate.methodName = methodProp.stringValue;

        if (eventDelegate.isValid == false)
        {
            return(lines);
        }

        SerializedProperty paramArrayProp = prop.FindPropertyRelative("mParameters");

        EventDelegate.Parameter[] ps = eventDelegate.parameters;

        if (ps != null)
        {
            EventDelegate.Parameter param = null;

            int imax = ps.Length;
            paramArrayProp.arraySize = imax;
            for (int i = 0; i < imax; i++, param = null)
            {
                param = ps [i];

                lines += lineHeight;

                SerializedProperty paramProp = paramArrayProp.GetArrayElementAtIndex(i);
                SerializedProperty objProp   = paramProp.FindPropertyRelative("obj");

                bool useManualValue = paramProp.FindPropertyRelative("paramRefType").enumValueIndex == (int)ParameterType.Value;

                if (useManualValue)
                {
                    if (param.expectedType == typeof(string) || param.expectedType == typeof(int) ||
                        param.expectedType == typeof(float) || param.expectedType == typeof(double) ||
                        param.expectedType == typeof(bool) || param.expectedType.IsEnum ||
                        param.expectedType == typeof(Color))
                    {
                        continue;
                    }
                    else if (param.expectedType == typeof(Vector2) || param.expectedType == typeof(Vector3) || param.expectedType == typeof(Vector4))
                    {
                        //if (lineRect.width < minimalistWidth) //use minimalist method
                        //{
                        //    if (param.expectedType == typeof(Vector2) || param.expectedType == typeof(Vector3))
                        //    {
                        //        lines += lineHeight;
                        //    }
                        //}
                        lines += 4;
                        continue;
                    }
                }

                UnityEngine.Object obj = objProp.objectReferenceValue;

                if (obj == null)
                {
                    continue;
                }

                System.Type type = obj.GetType();

                GameObject selGO = null;
                if (type == typeof(GameObject))
                {
                    selGO = obj as GameObject;
                }
                else if (type.IsSubclassOf(typeof(Component)))
                {
                    selGO = (obj as Component).gameObject;
                }

                if (selGO != null)
                {
                    lines += lineHeight;
                }
            }
        }

        return(lines);
    }
    public override void OnGUI(Rect rect, SerializedProperty prop, GUIContent label)
    {
        Undo.RecordObject(prop.serializedObject.targetObject, "Delegate Selection");

        EditorGUI.BeginProperty(rect, label, prop);
        int indent = EditorGUI.indentLevel;

        SerializedProperty showGroup = prop.FindPropertyRelative("mShowGroup");

        SerializedProperty nameProp   = prop.FindPropertyRelative("mEventName");
        SerializedProperty targetProp = prop.FindPropertyRelative("mTarget");
        SerializedProperty methodProp = prop.FindPropertyRelative("mMethodName");


        SerializedProperty updateMethodsProp = prop.FindPropertyRelative("mUpdateEntryList");

        if (EditorApplication.isCompiling)
        {
            updateMethodsProp.boolValue = true;
        }



        string eventName = nameProp.stringValue;

        UnityEngine.Object target = targetProp.objectReferenceValue;

        //controls
        Rect tempRect = new Rect(rect.x, rect.y, rect.width, lineHeight);

        showGroup.boolValue = EditorGUI.Foldout(tempRect, showGroup.boolValue, label, true);



        if (showGroup.boolValue)
        {
            EditorGUI.indentLevel++;

            lineRect      = rect;
            lineRect.yMin = rect.yMin + lineHeight;
            lineRect.yMax = lineRect.yMin + lineHeight;

            eventName            = EditorGUI.TextField(lineRect, eventName);
            nameProp.stringValue = eventName;

            lineRect.yMin += lineHeight;
            lineRect.yMax += lineHeight;

            target = EditorGUI.ObjectField(lineRect, "Notify", target, typeof(UnityEngine.Object), true);

            lineRect.yMin += lineHeight;
            lineRect.yMax += lineHeight;

            //painting manual refresh icon
            tempRect         = lineRect;
            tempRect.xMin    = lineRect.width + mIconSize - 4;
            tempRect.height -= 1;

            if (mRefreshIconStyle == null)
            {
                mRefreshIconStyle = new GUIStyle();

                if (mRefreshIcon == null)
                {
                    mRefreshIcon = Resources.Load <Texture2D>("refresh_icon");
                }

                if (mRefreshIcon != null)
                {
                    mRefreshIconStyle.normal.background = mRefreshIcon;
                }
            }

            if (GUI.Button(tempRect, mRefreshIcon))
            {
                updateMethodsProp.boolValue = true;
            }

            //update method list if target component was modified
            if (targetProp.objectReferenceValue != target)
            {
                updateMethodsProp.boolValue = true;
            }

            targetProp.objectReferenceValue = target;

            //checking for notify target
            if (target != null)
            {
                if (!mMethodCache.ContainsKey(target.name))
                {
                    mMethodCache.Add(target.name, new List <Entry>());
                }

                List <Entry>       listWithParams = mMethodCache[target.name];
                SerializedProperty entryArrayProp = prop.FindPropertyRelative("mEntryList");

                if (updateMethodsProp.boolValue && EditorApplication.isCompiling == false)
                {
                    //refresh methods names from target
                    listWithParams.Clear();

                    GameObject go = target as GameObject;
                    if (go == null)
                    {
                        Component component = target as Component;
                        if (target)
                        {
                            UpdateMethods(listWithParams, entryArrayProp, updateMethodsProp, component.gameObject);
                        }
                    }
                    else
                    {
                        UpdateMethods(listWithParams, entryArrayProp, updateMethodsProp, go);
                    }

                    mMethodCache[target.name] = listWithParams;
                }
                else if (listWithParams.Count == 0 && !prop.serializedObject.isEditingMultipleObjects)
                {
                    //create new Entry list from array
                    listWithParams.Clear();
                    SerializedProperty entryItem;

                    SerializedProperty itemTarget = null;
                    string             name       = String.Empty;
                    UnityEngine.Object targetComp = null;

                    int arraySize = entryArrayProp.arraySize;
                    for (int i = 0; i < arraySize; i++, entryItem = null, itemTarget = null,
                         name = String.Empty, targetComp = null)
                    {
                        entryItem = entryArrayProp.GetArrayElementAtIndex(i);

                        if (entryItem == null)
                        {
                            continue;
                        }

                        itemTarget = entryItem.FindPropertyRelative("target");

                        if (itemTarget == null)
                        {
                            continue;
                        }

                        targetComp = itemTarget.objectReferenceValue;
                        name       = entryItem.FindPropertyRelative("name").stringValue;
                        // Debug.Log(targetComp+" "+ name);
                        listWithParams.Add(new Entry(targetComp, name));
                    }

                    mMethodCache[target.name] = listWithParams;
                }

                int index  = 0;
                int choice = 0;

                string methodName = methodProp.stringValue;

                //check and trim missing method message here
                if (methodName.StartsWith("<Missing - ") == true)
                {
                    methodName = methodName.Replace("<Missing - ", "");
                    methodName = methodName.Replace(">", "");
                }

                string[] names = GetNames(listWithParams, methodName, true, out index, methodProp);

                //painting event list popup
                tempRect       = lineRect;
                tempRect.xMax -= mIconSize;
                choice         = EditorGUI.Popup(tempRect, "Event", index, names);

                //Debug.Log(names[0]);

                //saving selected method or field
                if (choice > 0)
                {
                    Entry entry = listWithParams [choice - 1];

                    if (target != entry.target)
                    {
                        target = entry.target as UnityEngine.Object;
                        targetProp.objectReferenceValue = target;

                        SerializedProperty cacheProp = prop.FindPropertyRelative("mCached");
                        cacheProp.boolValue = false;
                    }

                    methodName = entry.name;
                    //   Debug.Log(methodName);
                    //remove params
                    if (string.IsNullOrEmpty(methodName) == false && methodName.Contains(" ("))
                    {
                        methodName = methodName.Remove(methodName.IndexOf(" ("));
                    }

                    if (methodName != methodProp.stringValue)
                    {
                        methodProp.stringValue = methodName;
                        entry.name             = methodName;

                        SerializedProperty cacheProp = prop.FindPropertyRelative("mCached");
                        cacheProp.boolValue = false;
                    }
                }

                eventDelegate.target     = target;
                eventDelegate.methodName = methodName;

                //showing if method or field is missing
                if (eventDelegate.isValid == false)
                {
                    if (methodName.StartsWith("<Missing - ") == false)
                    {
                        methodName = "<Missing - " + methodName + ">";
                    }

                    methodProp.stringValue = methodName;

                    EditorGUI.indentLevel = indent;
                    EditorGUI.EndProperty();
                    return;
                }

                //showing parameters
                SerializedProperty        paramArrayProp = prop.FindPropertyRelative("mParameters");
                EventDelegate.Parameter[] ps             = eventDelegate.parameters;

                if (ps != null)
                {
                    bool showGameObject = false;

                    float paramTypeWidth  = 84;
                    float lineOriginalMax = lineRect.xMax;
                    lineRect.xMax -= 68;

                    int imax = ps.Length;
                    paramArrayProp.arraySize = imax;
                    for (int i = 0; i < imax; i++)
                    {
                        EventDelegate.Parameter param     = ps [i];
                        SerializedProperty      paramProp = paramArrayProp.GetArrayElementAtIndex(i);

                        SerializedProperty objProp   = paramProp.FindPropertyRelative("obj");
                        SerializedProperty fieldProp = paramProp.FindPropertyRelative("field");

                        param.obj   = objProp.objectReferenceValue;
                        param.field = fieldProp.stringValue;

                        lineRect.yMin += lineHeight;
                        lineRect.yMax += lineHeight;

                        //showing param info
                        string paramDesc = GetSimpleName(param.expectedType);
                        paramDesc += " " + param.name;

                        //paint value/reference selection for primitive types
                        if (IsPrimitiveType(param.expectedType))
                        {
                            if (lineOriginalMax == lineRect.xMax)
                            {
                                lineRect.xMax -= 68;
                            }

                            //only do this if parameter is a primitive type
                            tempRect.x      = lineRect.x + lineRect.width - 12;
                            tempRect.y      = lineRect.y;
                            tempRect.width  = paramTypeWidth;
                            tempRect.height = lineHeight;

                            SerializedProperty paramTypeProp = paramProp.FindPropertyRelative("paramRefType");

                            //draw param type option
                            EditorGUI.PropertyField(tempRect, paramTypeProp, GUIContent.none);
                            param.paramRefType = (ParameterType)paramTypeProp.enumValueIndex;
                        }
                        else
                        {
                            lineRect.xMax = lineOriginalMax;
                        }

                        bool useManualValue = paramProp.FindPropertyRelative("paramRefType").enumValueIndex == (int)ParameterType.Value;

                        if (useManualValue)
                        {
                            if (param.expectedType == typeof(string))
                            {
                                SerializedProperty valueProp = paramProp.FindPropertyRelative("argStringValue");
                                EditorGUI.PropertyField(lineRect, valueProp, new GUIContent(paramDesc));

                                param.value = valueProp.stringValue;
                            }
                            else if (param.expectedType == typeof(int))
                            {
                                SerializedProperty valueProp = paramProp.FindPropertyRelative("argIntValue");
                                EditorGUI.PropertyField(lineRect, valueProp, new GUIContent(paramDesc));

                                param.value = valueProp.intValue;
                            }
                            else if (param.expectedType == typeof(float))
                            {
                                SerializedProperty valueProp = paramProp.FindPropertyRelative("argFloatValue");
                                EditorGUI.PropertyField(lineRect, valueProp, new GUIContent(paramDesc));

                                param.value = valueProp.floatValue;
                            }
                            else if (param.expectedType == typeof(double))
                            {
                                SerializedProperty valueProp = paramProp.FindPropertyRelative("argDoubleValue");
                                EditorGUI.PropertyField(lineRect, valueProp, new GUIContent(paramDesc));

                                param.value = valueProp.doubleValue;
                            }
                            else if (param.expectedType == typeof(bool))
                            {
                                SerializedProperty valueProp = paramProp.FindPropertyRelative("argBoolValue");
                                EditorGUI.PropertyField(lineRect, valueProp, new GUIContent(paramDesc));

                                param.value = valueProp.boolValue;
                            }
                            else if (param.expectedType == typeof(Color))
                            {
                                SerializedProperty valueProp = paramProp.FindPropertyRelative("argColor");
                                EditorGUI.PropertyField(lineRect, valueProp, new GUIContent(paramDesc));

                                param.value = valueProp.colorValue;
                            }
                            else if (param.expectedType == typeof(Vector2))
                            {
                                SerializedProperty valueProp = paramProp.FindPropertyRelative("argVector2");
                                lineRect.y += 2;

                                EditorGUI.PropertyField(lineRect, valueProp, new GUIContent(paramDesc));

                                param.value = valueProp.vector2Value;
                            }
                            else if (param.expectedType == typeof(Vector3))
                            {
                                SerializedProperty valueProp = paramProp.FindPropertyRelative("argVector3");
                                lineRect.y += 2;

                                EditorGUI.PropertyField(lineRect, valueProp, new GUIContent(paramDesc));

                                param.value = valueProp.vector3Value;
                            }
                            else if (param.expectedType == typeof(Vector4))
                            {
                                SerializedProperty valueProp = paramProp.FindPropertyRelative("argVector4");
                                Vector4            vec4      = valueProp.vector4Value;

                                lineRect.y += 2;

                                //workaround for vector 4, it uses an extra line.
                                //valueProp.vector4Value = EditorGUI.Vector4Field(lineRect, paramDesc, valueProp.vector4Value);

                                //create all this values just once
                                if (vec4Values == null)
                                {
                                    vec4Values = new float[4];
                                }

                                vec4Values[0] = vec4.x;
                                vec4Values[1] = vec4.y;
                                vec4Values[2] = vec4.z;
                                vec4Values[3] = vec4.w;

                                if (vec4GUIContent == null)
                                {
                                    vec4GUIContent = new GUIContent[4];
                                }

                                vec4GUIContent[0] = new GUIContent("X");
                                vec4GUIContent[1] = new GUIContent("Y");
                                vec4GUIContent[2] = new GUIContent("Z");
                                vec4GUIContent[3] = new GUIContent("W");

                                EditorGUI.LabelField(lineRect, paramDesc);

                                tempRect       = lineRect;
                                tempRect.xMin += (EditorGUI.indentLevel * lineHeight) + 86;

                                EditorGUI.MultiFloatField(tempRect, vec4GUIContent, vec4Values);

                                valueProp.vector4Value = new Vector4(vec4Values[0], vec4Values[1], vec4Values[2], vec4Values[3]);
                                param.value            = valueProp.vector4Value;
                            }
                            else if (param.expectedType.IsEnum)
                            {
                                SerializedProperty valueProp = paramProp.FindPropertyRelative("argIntValue");

                                if (param.expectedType.GetAttribute <FlagsAttribute>() != null)
                                {
                                    param.value = EditorGUI.MaskField(lineRect, new GUIContent(paramDesc), valueProp.intValue, Enum.GetNames(param.expectedType));
                                }
                                else
                                {
                                    Enum selectedOpt = (Enum)Enum.ToObject(param.expectedType, valueProp.intValue);
                                    param.value = EditorGUI.EnumPopup(lineRect, new GUIContent(paramDesc), selectedOpt);
                                }

                                valueProp.intValue = (int)param.value;
                            }
                            else
                            {
                                showGameObject = true;
                            }
                        }

                        if (showGameObject || !useManualValue)
                        {
                            UnityEngine.Object obj = param.obj;

                            obj = EditorGUI.ObjectField(lineRect, paramDesc, obj, typeof(UnityEngine.Object), true);

                            param.obj = obj;
                            objProp.objectReferenceValue = obj;

                            if (obj == null)
                            {
                                continue;
                            }

                            //show gameobject
                            GameObject  selGO = null;
                            System.Type type  = param.obj.GetType();
                            if (type == typeof(GameObject))
                            {
                                selGO = param.obj as GameObject;
                            }
                            else if (type.IsSubclassOf(typeof(Component)))
                            {
                                selGO = (param.obj as Component).gameObject;
                            }

                            if (selGO != null)
                            {
                                // Parameters must be exact -- they can't be converted like property bindings
                                filter     = param.expectedType;
                                canConvert = false;
                                List <Entry> ents = GetProperties(selGO, true, false);

                                int      selection;
                                string[] props = GetNames(ents, EventDelegate.GetFuncName(param.obj, param.field), false, out selection);

                                lineRect.yMin += lineHeight;
                                lineRect.yMax += lineHeight;
                                int newSel = EditorGUI.Popup(lineRect, " ", selection, props);

                                if (newSel != selection)
                                {
                                    if (newSel == 0)
                                    {
                                        param.obj   = selGO;
                                        param.field = null;

                                        objProp.objectReferenceValue = selGO;
                                        fieldProp.stringValue        = null;
                                    }
                                    else
                                    {
                                        param.obj   = ents[newSel - 1].target;
                                        param.field = ents[newSel - 1].name;

                                        objProp.objectReferenceValue = param.obj;
                                        fieldProp.stringValue        = param.field;
                                    }
                                }
                            }
                            else if (!string.IsNullOrEmpty(param.field))
                            {
                                param.field = null;
                            }

                            filter     = typeof(void);
                            canConvert = true;
                        }

                        showGameObject = false;
                    }
                }
            }
        }

        EditorGUI.indentLevel = indent;
        EditorGUI.EndProperty();
    }