예제 #1
0
 public GameObjectRef(eSourceType sourceType)
 {
     _sourceType      = sourceType;
     _objectName      = string.Empty;
     _scene           = new SceneRef();
     _sceneObjectID   = -1;
     _prefab          = new AssetRef <GameObject>();
     _gameObject      = null;
     _sourceObject    = null;
     _editorCollapsed = false;
 }
예제 #2
0
            public bool RenderObjectProperties(GUIContent label)
            {
                bool dataChanged = false;

                if (label == null)
                {
                    label = new GUIContent();
                }

                label.text += " (" + this + ")";

                _editorFoldout = EditorGUILayout.Foldout(_editorFoldout, label);
                if (_editorFoldout)
                {
                    int origIndent = EditorGUI.indentLevel;
                    EditorGUI.indentLevel++;

                    //Show drop down
                    eSourceType prevType = _sourceType;
                    _sourceType = SerializedObjectEditorGUILayout.ObjectField(_sourceType, "Source Type", out dataChanged);

                    if (prevType != _sourceType)
                    {
                        ClearGameObject();
                        dataChanged = true;
                    }

                    switch (_sourceType)
                    {
                    case eSourceType.Scene:
                    {
                        dataChanged |= RenderSceneObjectProperties();
                    }
                    break;

                    case eSourceType.Prefab:
                    {
                        dataChanged |= RenderPrefabProperties();
                    }
                    break;

                    case eSourceType.Loaded:
                    {
                        dataChanged |= RenderLoadedProperties();
                    }
                    break;
                    }

                    EditorGUI.indentLevel = origIndent;
                }

                return(dataChanged);
            }
예제 #3
0
            public virtual bool RenderObjectProperties(GUIContent label)
            {
                bool dataChanged = false;

                if (label == null)
                {
                    label = new GUIContent();
                }

                label.text += " (" + (typeof(T) == typeof(float) ? "float" : typeof(T).Name) + ")";

                _editorFoldout = EditorGUILayout.Foldout(_editorFoldout, label);
                if (_editorFoldout)
                {
                    int origIndent = EditorGUI.indentLevel;
                    EditorGUI.indentLevel++;

                    _sourceType = SerializedObjectEditorGUILayout.ObjectField(_sourceType, new GUIContent("Input Type", "Static: Value will be constant.\nNode: Value read from other nodes output."), out dataChanged);
                    if (dataChanged)
                    {
                        ClearStaticValue();
                        _sourceNodeId = -1;
                    }

                    switch (_sourceType)
                    {
                    case eSourceType.Static:
                    {
                        dataChanged |= RenderStaticValueProperty();
                    }
                    break;

                    case eSourceType.Node:
                    {
                        dataChanged |= DrawNodeNamePopUps();
                    }
                    break;
                    }

                    EditorGUI.indentLevel = origIndent;
                }

                return(dataChanged);
            }
예제 #4
0
        void Setup(
            String GridName
            , eSourceType SourceType
            , Object Datasource
            , ClsBindGrid GridDefinition
            , Boolean IsSelection = false
            , List<String> List_TableKey = null
            , Boolean AllowSort = false
            , Boolean AllowPaging = false
            , Boolean IsDefault = false)
        {
            this.mProperties = new UcGrid_Properties();
            this.mProperties.SourceType = SourceType;

            switch (SourceType)
            {
                case eSourceType.Base:
                    this.mProperties.Datasource_Base = (ClsBase)Datasource;
                    break;
                case eSourceType.DataTable:
                    this.mProperties.Datasource_Dt = (DataTable)Datasource;
                    break;
                case eSourceType.Table:
                    this.mProperties.Datasource_TableName = (String)Datasource;
                    break;
                case eSourceType.QuerySource:
                    this.mProperties.Datasource_QuerySource = (Do_Constants.Str_QuerySource)Datasource;
                    break;
            }

            this.mProperties.GridDefinition = GridDefinition;
            this.mProperties.IsSelection = IsSelection;
            //this.mProperties.TableKey = KeyName;
            this.mProperties.List_TableKey = List_TableKey;
            this.mProperties.AllowSort = AllowSort;
            this.mProperties.AllowPaging = AllowPaging;
            this.mProperties.GridName = GridName;

            this.BindGrid(IsDefault);

            this.Setup_EventHandlers();
        }
        public void Setup(
            ClsSysCurrentUser CurrentUser
            , List<ClsBindGridColumn_Web_Telerik> BindDefinition = null
            , string Key = ""
            , bool AllowSort = false
            , bool AllowPaging = false
            , eSourceType SourceType =  eSourceType.Base
            , Methods_Web_Telerik.eSelectorType SelectorType = Methods_Web_Telerik.eSelectorType.None
            , string ModuleName = ""
            , bool IsPersistent = true
            , bool IsBind = false)
        {
            if (SelectorType != Methods_Web_Telerik.eSelectorType.None && Key.Trim() == "")
            { throw new Exception("Key is required when using selectors."); }

            if (this.mObjID == null)
            {
                this.mCurrentUser = CurrentUser;
                this.mObjID = this.mCurrentUser.GetNewPageObjectID();
                this.ViewState[CnsObjID] = this.mObjID;
            }

            this.mProperties = new Control_GridList_Properties();
            this.ViewState[CnsProperties] = this.mProperties;

            this.mProperties.BindDefinition = BindDefinition;
            this.mProperties.Key = Key;
            this.mProperties.AllowSort = AllowSort;
            this.mProperties.AllowPaging = AllowPaging;
            //this.mProperties.IsRequery = IsRequery;
            this.mProperties.SourceType = SourceType;
            this.mProperties.SelectorType = SelectorType;
            this.mProperties.ModuleName = ModuleName != "" ? CnsState_GridList + ModuleName : CnsState_GridList + this.Page.Request.Url.AbsolutePath;
            this.mProperties.IsPersistent = IsPersistent;

            if (this.mProperties.IsPersistent)
            {
                this.mState = (Control_GridList_State)this.Session[this.mProperties.ModuleName];
                if (this.mState == null)
                {
                    this.mState = new Control_GridList_State();
                    this.Session[this.mProperties.ModuleName] = this.mState;
                }
            }
            else
            {
                this.mState = new Control_GridList_State();
                this.ViewState[CnsState_GridList] = this.mState;
            }

            if (IsBind)
            { this.BindGrid(); }
        }
예제 #6
0
 public void SetSourceNode(int nodeId)
 {
     ClearStaticValue();
     _sourceNodeId = nodeId;
     _sourceType   = nodeId != -1 ? eSourceType.Node : eSourceType.Static;
 }
예제 #7
0
            public GameObjectRef(eSourceType sourceType, GameObject gameObject)
            {
                _sourceType      = sourceType;
                _sourceObject    = null;
                _editorCollapsed = false;
                _prefab          = new AssetRef <GameObject>();
                _scene           = new SceneRef();
                _gameObject      = gameObject;

                switch (sourceType)
                {
                case eSourceType.Prefab:
                {
                    GameObject prefabAsset = (GameObject)PrefabUtility.GetPrefabParent(gameObject);

                    if (prefabAsset != null)
                    {
                        gameObject = prefabAsset;
                    }

                    //Then find its root
                    GameObject prefabRoot = PrefabUtility.FindPrefabRoot(gameObject);

                    if (prefabRoot != null)
                    {
                        _objectName = GameObjectUtils.GetChildFullName(gameObject, prefabRoot);
                        _prefab     = new AssetRef <GameObject>(prefabRoot);
                    }
                    else
                    {
                        _objectName = string.Empty;
                    }

                    _sceneObjectID = -1;
                }
                break;

                case eSourceType.Loaded:
                {
                    GameObjectLoader loader = gameObject.GetComponentInParent <GameObjectLoader>();

                    if (loader != null)
                    {
                        _scene         = new SceneRef(loader.gameObject.scene);
                        _sceneObjectID = SceneIndexer.GetIdentifier(loader.gameObject);

                        if (gameObject != null && GameObjectUtils.IsChildOf(gameObject.transform, loader.transform))
                        {
                            _objectName = GameObjectUtils.GetChildFullName(gameObject, loader.gameObject);
                        }
                        else
                        {
                            _objectName = null;
                        }
                    }
                    else
                    {
                        _objectName    = null;
                        _sceneObjectID = -1;
                    }
                }
                break;

                default:
                case eSourceType.Scene:
                {
                    if (gameObject != null && gameObject.scene.IsValid())
                    {
                        _scene         = new SceneRef(gameObject.scene);
                        _objectName    = gameObject.name;
                        _sceneObjectID = SceneIndexer.GetIdentifier(gameObject);
                    }
                    else
                    {
                        _objectName    = string.Empty;
                        _sceneObjectID = -1;
                    }
                }
                break;
                }
            }