コード例 #1
0
        public static void SetOwnerDefault(Skill fsm, SkillStateAction action, GameObject targetGO, string fieldName = "gameObject")
        {
            FieldInfo field = action.GetType().GetField(fieldName, 20);

            if (field != null && fsm.get_GameObject() != targetGO)
            {
                FieldInfo         arg_3C_0        = field;
                SkillOwnerDefault fsmOwnerDefault = new SkillOwnerDefault();
                fsmOwnerDefault.set_OwnerOption(1);
                fsmOwnerDefault.set_GameObject(targetGO);
                arg_3C_0.SetValue(action, fsmOwnerDefault);
            }
        }
コード例 #2
0
        private static object TryConvertValue(Type fieldType, object currentValue, object value)
        {
            if (value == null)
            {
                return(null);
            }
            Type type = value.GetType();

            if (fieldType == typeof(GameObject))
            {
                if (type.IsSubclassOf(typeof(Component)))
                {
                    return(((Component)value).get_gameObject());
                }
            }
            else
            {
                if (fieldType == typeof(SkillGameObject))
                {
                    if (type == typeof(GameObject))
                    {
                        return(new SkillGameObject(value as GameObject));
                    }
                    if (type.IsSubclassOf(typeof(Component)))
                    {
                        return(new SkillGameObject(((Component)value).get_gameObject()));
                    }
                }
                else
                {
                    if (fieldType == typeof(SkillOwnerDefault))
                    {
                        if (type == typeof(GameObject))
                        {
                            SkillOwnerDefault fsmOwnerDefault = new SkillOwnerDefault();
                            fsmOwnerDefault.set_OwnerOption(1);
                            fsmOwnerDefault.set_GameObject(value as GameObject);
                            return(fsmOwnerDefault);
                        }
                        if (type.IsSubclassOf(typeof(Component)))
                        {
                            GameObject gameObject = ((Component)value).get_gameObject();
                            if (gameObject != SkillEditor.SelectedFsmGameObject)
                            {
                                SkillOwnerDefault fsmOwnerDefault2 = new SkillOwnerDefault();
                                fsmOwnerDefault2.set_OwnerOption(1);
                                fsmOwnerDefault2.set_GameObject(gameObject);
                                return(fsmOwnerDefault2);
                            }
                            return(new SkillOwnerDefault());
                        }
                    }
                    else
                    {
                        if (fieldType == typeof(SkillProperty))
                        {
                            SkillProperty fsmProperty  = currentValue as SkillProperty;
                            SkillProperty fsmProperty2 = new SkillProperty();
                            SkillProperty arg_14D_0    = fsmProperty2;
                            SkillObject   fsmObject    = new SkillObject();
                            fsmObject.set_Value(value as Object);
                            arg_14D_0.TargetObject   = fsmObject;
                            fsmProperty2.setProperty = (fsmProperty != null && fsmProperty.setProperty);
                            return(fsmProperty2);
                        }
                        if (fieldType == typeof(SkillObject))
                        {
                            SkillObject fsmObject2 = new SkillObject();
                            fsmObject2.set_Value(value as Object);
                            return(fsmObject2);
                        }
                        if (fieldType == typeof(SkillMaterial))
                        {
                            SkillMaterial fsmMaterial = new SkillMaterial();
                            fsmMaterial.set_Value(value as Material);
                            return(fsmMaterial);
                        }
                        if (fieldType == typeof(SkillTexture))
                        {
                            SkillTexture fsmTexture = new SkillTexture();
                            fsmTexture.set_Value(value as Texture);
                            return(fsmTexture);
                        }
                        if (fieldType == typeof(SkillEventTarget))
                        {
                            if (type == typeof(PlayMakerFSM))
                            {
                                return(new SkillEventTarget
                                {
                                    target = 3,
                                    fsmComponent = value as PlayMakerFSM
                                });
                            }
                            if (type == typeof(GameObject))
                            {
                                SkillEventTarget fsmEventTarget = new SkillEventTarget();
                                fsmEventTarget.target = 1;
                                SkillEventTarget  arg_253_0        = fsmEventTarget;
                                SkillOwnerDefault fsmOwnerDefault3 = new SkillOwnerDefault();
                                fsmOwnerDefault3.set_OwnerOption(1);
                                fsmOwnerDefault3.set_GameObject(value as GameObject);
                                arg_253_0.gameObject = fsmOwnerDefault3;
                                return(fsmEventTarget);
                            }
                        }
                        else
                        {
                            if (fieldType == typeof(SkillString))
                            {
                                if (type == typeof(PlayMakerFSM))
                                {
                                    SkillString fsmString = new SkillString();
                                    fsmString.set_Value(((PlayMakerFSM)value).get_FsmName());
                                    return(fsmString);
                                }
                                if (type == typeof(AnimationClip))
                                {
                                    SkillString fsmString2 = new SkillString();
                                    fsmString2.set_Value(((AnimationClip)value).get_name());
                                    return(fsmString2);
                                }
                            }
                        }
                    }
                }
            }
            return(value);
        }