示例#1
0
 private static bool TryCreateDefaultCodeInfo(string path, out CocosInfo codeInfo)
 {
     try
     {
         string path1 = Path.Combine(path, "version");
         if (File.Exists(path1))
         {
             CocosInfo cocosInfo = new CocosInfo();
             cocosInfo.RootPath    = path;
             cocosInfo.MainVersion = 3;
             cocosInfo.EnableCpp   = true;
             cocosInfo.EnableLua   = true;
             cocosInfo.EnableJs    = false;
             cocosInfo.IsDefault   = true;
             StreamReader streamReader = new StreamReader(path1);
             cocosInfo.VersionText = streamReader.ReadLine();
             codeInfo = cocosInfo;
             return(true);
         }
         codeInfo = (CocosInfo)null;
         return(false);
     }
     catch (Exception ex)
     {
         LogConfig.Logger.Error((object)("获取默认引擎信息失败:\r\n" + ex.ToString()));
         codeInfo = (CocosInfo)null;
         return(false);
     }
 }
示例#2
0
        internal static CocosInfo CreateCustomInfo(string path = "", bool isAutoCheck = false)
        {
            CocosInfo codeInfo    = (CocosInfo)null;
            string    defaultPath = CocosInfo.GetDefaultPath();

            if (!string.IsNullOrEmpty(defaultPath))
            {
                if ((string.IsNullOrEmpty(path) || CocosInfo.CheckIsDefault(path)) && CocosInfo.TryCreateDefaultCodeInfo(defaultPath, out codeInfo))
                {
                    return(codeInfo);
                }
            }
            else if (string.IsNullOrEmpty(path))
            {
                return((CocosInfo)null);
            }
            if (CocosInfo.TryCreateCodeInfoV2(path, out codeInfo) || CocosInfo.TryCreateCodeInfoV3(path, out codeInfo) || (CocosInfo.TryCreateCodeInfoV3_JS(path, out codeInfo) || CocosInfo.TryCreateCodeInfoWithoutVersion(path, out codeInfo)))
            {
                return(codeInfo);
            }
            if (!isAutoCheck)
            {
                return((CocosInfo)null);
            }
            if (CocosInfo.TryCreateDefaultCodeInfo(defaultPath, out codeInfo))
            {
                return(codeInfo);
            }
            return((CocosInfo)null);
        }
示例#3
0
        private static string TryGetVersionFileV3_js(Solution sln)
        {
            string str = Path.Combine((string)sln.BaseDirectory, "frameworks", "js-bindings", "cocos2d-x", "cocos", "cocos2d.cpp");

            if (File.Exists(str))
            {
                return(CocosInfo.GetVersionText(str));
            }
            return(string.Empty);
        }
示例#4
0
 private static bool TryCreateCodeInfoWithoutVersion(string path, out CocosInfo codeInfo)
 {
     if (File.Exists(Path.Combine(path, "templates", "cocos2dx_files.json")))
     {
         codeInfo = new CocosInfo()
         {
             RootPath    = path,
             MainVersion = 3,
             EnableCpp   = true,
             EnableLua   = true,
             EnableJs    = false,
             VersionText = "Cocos2d-x 3.0"
         };
         return(true);
     }
     codeInfo = (CocosInfo)null;
     return(false);
 }
示例#5
0
        private static bool TryCreateCodeInfoV3_JS(string path, out CocosInfo codeInfo)
        {
            string str = Path.Combine(path, "frameworks", "js-bindings", "cocos2d-x", "cocos", "cocos2d.cpp");

            if (File.Exists(str))
            {
                codeInfo = new CocosInfo()
                {
                    RootPath    = path,
                    MainVersion = 3,
                    EnableCpp   = false,
                    EnableLua   = false,
                    EnableJs    = true,
                    VersionText = CocosInfo.GetVersionText(str)
                };
                return(true);
            }
            codeInfo = (CocosInfo)null;
            return(false);
        }
示例#6
0
 private static bool CheckIsDefault(string path)
 {
     return(Path.GetFullPath(CocosInfo.GetDefaultPath().ToLower()).Equals(Path.GetFullPath(path.ToLower())));
 }
示例#7
0
 public CreateParams(string projectName, string directory, string packageName, CocosInfo engineInfo, EnumProjectLanguage language)
 {
     this.ProjName        = projectName;
     this.Directory       = directory;
     this.PkgName         = packageName;
     this.EngineInfo      = engineInfo;
     this.Language        = language;
     this.UseCCF          = false;
     this.UseX86          = false;
     this.X86Type         = ECompilerType.Null;
     this.UseSource       = true;
     this.UseCodeIDE      = true;
     this.OpenWithCodeIDE = false;
 }
示例#8
0
 public CocosInfo GetCocosInfo(string path = null, bool isAutoCheck = false)
 {
     return(CocosInfo.CreateCustomInfo(path, isAutoCheck));
 }