コード例 #1
0
        void HandleInput(Event e)
        {
            if (Event.current.isKey)
            {
                Listen();
                string[] paras = command.Split('.');


                switch (paras.Length)
                {
                case 1:
                    isClassIntent    = false;
                    isMethodIntent   = false;
                    isFieldIntent    = false;
                    searchCollection = TryGetClass(paras[0]);
                    break;

                case 2:
                    if (!isClassIntent)
                    {
                        type           = XReflectionUtils.TryGetClass(paras[0]);
                        isClassIntent  = true;
                        isMethodIntent = false;
                        isFieldIntent  = false;
                    }
                    searchCollection = TryGetMember(paras[1], true);
                    break;

                case 3:
                    if (!isMethodIntent)
                    {
                        //						object instance = TryInvokeGlobalFunction( paras[1] );
                        //						type = instance.GetType();
                        //						isMethodIntent = true;
                    }
                    searchCollection = TryGetMember(paras[2], false);
                    break;

                default:
                    break;
                }
            }
            DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
            if (Event.current.type == EventType.DragPerform)
            {
                DragAndDrop.AcceptDrag();
                foreach (var draggedObject in DragAndDrop.objectReferences)
                {
                    this.draggedObject = draggedObject;
                }
            }

            Repaint();
        }
コード例 #2
0
        void MatchPara()
        {
            var functions = command.RegexCutString("(", ")");

            for (int i = 0; i < functions.Length; i++)
            {
                var objs = paserPara(functions[i]);
            }
            List <object[]> paras = new List <object[]>();

            var clear = command.RegexCutStringReverse("(", ")");

            string[] commandPara = clear.Split('.');
            if (commandPara.Length > 0 && type == null && currValue == null)
            {
                type = XReflectionUtils.TryGetClass(commandPara[0]);
            }

            currValue = draggedObject;

            int allLenght = commandPara.Length;
            int funCount  = functions.Length;

            int startIndex = 1;

            if (currValue != null)
            {
                startIndex = 0;
            }
            for (int i = startIndex; i < startIndex + funCount; i++)
            {
                //  TODO loop in funCount
                if (currValue == null)
                {
                    currValue = type.TryInvokeGlobalMethod(commandPara[i]);
                }
                else
                {
                    currValue = currValue.GetType().TryInvokeMethod(currValue, commandPara[i]);
                }
            }
            int fieldCount = commandPara.Length - funCount;

            int fieldIndex = 1;

            if (currValue != null)
            {
                fieldIndex = 0;
            }
            for (int pos = fieldIndex; pos < fieldCount; pos++)
            {
                //  TODO loop in Length
                if (currValue == null)
                {
                    currValue = type.TrySearchGlobalMemberValue(commandPara[pos + startIndex]);
                }
                else
                {
                    currValue = currValue.TryGetFieldValue(commandPara[pos + startIndex]);
                }
            }
            XLogger.Log("currValue is : " + currValue.ToString());
        }