예제 #1
0
        public static CompoundType GetEventType(CompoundVariable _variable)
        {
            CompoundType type = GetUnwrappedType(_variable.CompoundType);
            if (type.TypeName.StartsWith("MyGUI::EventPair") ||
                type.TypeName.StartsWith("MyGUI::EventPair3to4"))
            {
                if (type.TemplateTypes.Count == 2)
                {
                    type = GetUnwrappedType(type.TemplateTypes[1]);
                }
            }

            return type;
        }
예제 #2
0
        public EventReplacer(CompoundVariable _variable)
        {
            mReplace["DelegateName"] = _variable.EventName;

            CompoundType eventType = CompoundUtility.GetEventType(_variable);

            int index = 1;
            foreach (var type in eventType.TemplateTypes)
            {
                mReplace["OriginalTypeName" + index.ToString()] = type.TypeName;
                mReplace["ValueName" + index.ToString()] = GetValueName(index - 1, _variable.ValueNames);

                TypeInfo parameInfo = WrapperManager.Instance.GetTypeInfo(type.TypeName);
                if (parameInfo != null)
                {
                    foreach (var value in parameInfo.Values)
                        mReplace[value.First + index.ToString()] = value.Second;
                }

                index++;
            }
        }
예제 #3
0
        private string GetEventTemplateName(CompoundVariable _variable)
        {
            CompoundType eventType = CompoundUtility.GetEventType(_variable);

            bool multiDelegate = CompoundUtility.IsEventMultiDelegate(eventType);
            bool request = _variable.Name.ToLowerInvariant().StartsWith("request");
            return string.Format("{0}{1}{2}.txt", multiDelegate ? "MultiDelegate" : "Delegate", request ? "Request" : "Event", eventType.TemplateTypes.Count);
        }
예제 #4
0
        private void AddClassEvent(CompoundVariable _variable, TemplateInfo _info, ClassInfo _classInfo, FileData _outputFile)
        {
            string templateName = _classInfo.GetTeplaceTemplate(_variable.Name);
            if (templateName == "")
                templateName = GetEventTemplateName(_variable);

            FileData template = mTemplateManager.GetTemplateCopy(GetTemplateFileName(_info.TemplateFolder, templateName));
            mReplaceManager.DoReplace(template, new IReplacer[] { _classInfo, new EventReplacer(_variable) });
            InsertData(_outputFile, template, mLabelName);
        }
예제 #5
0
 public static bool IsVariableEvent(CompoundVariable _variable)
 {
     CompoundType eventType = GetEventType(_variable);
     return eventType.TypeName.StartsWith("MyGUI::delegates::CDelegate") ||
         eventType.TypeName.StartsWith("MyGUI::delegates::CMultiDelegate");
 }