コード例 #1
0
ファイル: UIGenerator.cs プロジェクト: grashaar/uiman
        public void GenerateHandler(string backupCode, string baseType = null)
        {
            if (string.IsNullOrEmpty(baseType))
            {
                baseType = _selectedType.BaseType.Name;
            }

            var handlerCode = backupCode;

            if (string.IsNullOrEmpty(handlerCode))
            {
                handlerCode = UIManCodeGenerator.GenerateHandler(_selectedType.Name, baseType, _config, this.namespaceField.Text);
            }
            else
            {
                handlerCode = handlerCode.Replace($": {_selectedType.BaseType.Name}", $": {baseType}");
            }

            var saved = UIManCodeGenerator.SaveScript(_handlerScriptPath, handlerCode, false, _selectedType.BaseType.Name, baseType);

            if (saved)
            {
                AssetDatabase.Refresh(ImportAssetOptions.Default);
            }
        }
コード例 #2
0
        public void GenerateHandler(string scriptPath)
        {
            var handlerScriptPath = UIManCodeGenerator.GeneratPathWithSubfix(scriptPath, ".Handler.cs");
            var config            = EditorHelper.GetOrCreateScriptableObject <UIManConfig>(false);
            var handlerCode       = UIManCodeGenerator.GenerateHandler(this.typeName, this.baseType, config, this.namespaceField.Text);

            UIManCodeGenerator.SaveScript(handlerScriptPath, handlerCode, false, this.typeName, this.baseType);
        }