Exemple #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;
        }
Exemple #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++;
            }
        }
        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);
        }
        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);
        }
Exemple #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");
 }