コード例 #1
0
        private string GetName(string value, Transform tr)
        {
            var str = QGlobalFun.GetString(value);

            string name = str;
            int    i    = 1;

            while (true)
            {
                if (nameDic.ContainsKey(name))
                {
                    if (nameDic[name] == tr)
                    {
                        break;
                    }
                    name = string.Format("{0}{1}", str, i++);
                }
                else
                {
                    break;
                }
            }
            nameDic[name] = tr;

            return(name);
        }
コード例 #2
0
        public string GetControllerBuildCode()
        {
            assignment.Length  =
                declare.Length =
                    fun.Length = 0;
            string type = string.Empty;

            foreach (var value in dic.Values)
            {
                if (value.variableEvent != string.Empty && value.state.isEvent)
                {
                    type = value.IsButton() ? string.Empty : string.Format("{0} value", value.eventType);
                    //assignment.AppendFormat("\t\tui.{0,-50} = {1};\n", value.attributeName, value.eventName);
                    assignment.AppendFormat(QConfigure.assignmentFormat, value.attributeName, value.eventName);
                    //declare.AppendFormat("\tpartial void {0}({1});\n", value.attributeName, type);
                    declare.AppendFormat(QConfigure.declareFormat, value.attributeName, type);

                    /*fun.AppendFormat("\tprivate void {0}({1})\n\t{{\n\t\t{2}({3});\n\t}}\n",
                     *  value.eventName, type, value.attributeName, value.type == "Button" ? string.Empty : "value");*/
                    fun.AppendFormat(QConfigure.funFormat, value.eventName, type,
                                     value.attributeName, value.IsButton() ? string.Empty : "value");
                }
            }

            string code = string.Empty;

            if (QConfigure.isCreateModel)
            {
                code = QConfigure.controllerBuildCode;
            }
            else
            {
                code = QConfigure.controllerBuildCode2;
            }
            return(string.Format(
                       code,
                       QGlobalFun.GetString(QConfigure.selectTransform.name),
                       assignment,
                       declare,
                       fun));
        }
コード例 #3
0
 private static string GetFileName(string suffix)
 {
     return(string.Format("{0}/{1}_{0}", suffix, QGlobalFun.GetString(Selection.activeTransform.name)));
 }
コード例 #4
0
 public static string GetClassName(string suffix)
 {
     return(string.Format("{1}_{0}", suffix, QGlobalFun.GetString(Selection.activeTransform.name)));
 }
コード例 #5
0
        public string GetBuildUICode()
        {
            newAttribute.Length                        =
                attributeVariable.Length               =
                    function.Length                    =
                        register.Length                =
                            variable.Length            =
                                controllerEvent.Length =
                                    attribute.Length   =
                                        find.Length    = 0;

            foreach (var value in dic.Values)
            {
                if (!value.state.isVariable)
                {
                    continue;
                }
                variable.AppendFormat(QConfigure.variableFormat, value.type, value.name);

                if (isFind)
                {
                    //find.AppendFormat("\t\t{0,-25} = transform.Find(\"{1}\").GetComponent<{2}>();\n", value.name, value.path, value.type);
                    find.AppendFormat(QConfigure.findFormat, value.name, value.path, value.type);
                }

                if (value.state.isAttribute)
                {
                    if (value.isUI)
                    {
                        /*attributeVariable.AppendFormat("\tprivate Q{0} q{1};\n", value.type, value.name);
                         * attribute.AppendFormat("\tpublic Q{0} Q{1}{{get{{return q{1};}}}}\n", value.type, value.name);
                         * newAttribute.AppendFormat("\t\tq{0,-49} = new Q{1}({0});\n", value.name, value.type);*/
                        attributeVariable.AppendFormat(QConfigure.attributeVariableFormat, value.type, value.name);
                        attribute.AppendFormat(QConfigure.attributeFormat, value.type, value.name);
                        newAttribute.AppendFormat(QConfigure.newAttributeFormat, value.name, value.type);
                    }
                    else
                    {
                        //attribute.AppendFormat("\tpublic {0} Q{1}{{get{{return {1};}}}}\n", value.type, value.name);
                        attribute.AppendFormat(QConfigure.attribute2Format, value.type, value.name);
                    }
                }

                if (value.variableEvent != string.Empty && value.state.isEvent)
                {
                    /*register.AppendFormat("\t\t{0}.{1}.AddListener( {2} );\n", value.name, value.variableEvent, value.eventName);
                     * controllerEvent.AppendFormat("\tpublic Action{0,-20} {1};\n", value.type == "Button" ? string.Empty : string.Format("<{0}>", value.eventType), value.attributeName);
                     * function.AppendFormat("\tprivate void {0}({1})\n\t{{\n\t\tif({2}!=null){2}({3});\n\t}}\n", value.eventName,
                     *  value.eventType + (value.eventType != string.Empty ? " value" : ""), value.attributeName,
                     *  value.type == "Button" ? string.Empty : "value");*/
                    register.AppendFormat(QConfigure.registerFormat, value.name, value.variableEvent, value.eventName);
                    controllerEvent.AppendFormat(QConfigure.controllerEventFormat, value.IsButton() ? string.Empty : string.Format("<{0}>", value.eventType), value.attributeName);
                    function.AppendFormat(QConfigure.functionFormat, value.eventName,
                                          value.eventType + (!value.eventType.IsLengthZero() ? " value" : string.Empty), value.attributeName,
                                          value.IsButton() ? string.Empty : "value");
                    //Debug.Log(value.IsButton());
                }
            }

            var tmp = string.Format(QConfigure.uiClassCode,
                                    variable, attributeVariable, controllerEvent, attribute, find, newAttribute, register, function);

            return(string.Format(QConfigure.uiCode2, QGlobalFun.GetString(QConfigure.selectTransform.name), tmp));
        }
コード例 #6
0
 public string GetControllerCode()
 {
     return(string.Format(QConfigure.controllerCode, QGlobalFun.GetString(QConfigure.selectTransform.name)));
 }
コード例 #7
0
 public string GetModelCode()
 {
     return(string.Format(QConfigure.modelCode, QGlobalFun.GetString(QConfigure.selectTransform.name)));
 }
コード例 #8
0
 public string GetUICode()
 {
     return(string.Format(QConfigure.uiCode, QGlobalFun.GetString(QConfigure.selectTransform.name), QConfigure.uicodeOnAwake));
 }