Esempio n. 1
0
    //draws or hides a platform in either left or right side of an image target
    public void DrawHidePlatform(bool draw, PLATFORM platformType, SIDE drawSide)
    {
        GameObject targetToDrawPlatform = ImageTargetManager.Instance.GetCurrentMainTarget();

        if (cachedPlatforms.ContainsKey(platformType))
        {
            cachedPlatforms[platformType].SetActive(draw);
            if (draw)
            {
                ParentPlatformRootToImageTarget(targetToDrawPlatform,
                                                cachedPlatforms[platformType],
                                                drawSide);
            }
            return;
        }
        if (!draw)
        {
            return;
        }

        for (int i = 0; i < platforms.Count; i++)
        {
            if (platformType == platforms[i].PlatformType)
            {
                cachedPlatforms.Add(platformType, platforms[i].DrawGames(15));
                ParentPlatformRootToImageTarget(targetToDrawPlatform,
                                                cachedPlatforms[platformType],
                                                drawSide);
                return;
            }
        }
        Debug.LogError("Console " + consoleName +
                       " Doesnt have platform: " + platformType.ToString());
    }
    // Start is called before the first frame update
    private void Start()
    {
        mCam             = Camera.main;
        backgoundBounder = gameObject.GetComponent <SpriteRenderer>();

        //Init options
        loadCamSettings();
        //Init deadzone
        refreshDeadzone(backgoundBounder, mCam.orthographicSize);

        //Use preprocessor to get using platform
#if UNITY_STANDALONE
        platform = PLATFORM.STANDALONE;
        Debug.Log("UNITY_STANDALONE.STANDALONE");
#endif

#if UNITY_ANDROID
        platform = PLATFORM.PHONE;
        //Debug.Log("UNITY_ANDROID.PHONE");
#endif

#if UNITY_IPHONE
        platform = PLATFORM.PHONE;
        Debug.Log("UNITY_IPHONE.PHONE");
#endif

#if UNITY_EDITOR
        platform = PLATFORM.STANDALONE;
        //Debug.Log("UNITY_EDITOR.STANDALONE");
#endif
    }
Esempio n. 3
0
    // Start is called before the first frame update
    private void Start()
    {
        eventTrigger = this.GetComponent <EventTrigger>();
        sprite       = this.GetComponent <SpriteRenderer>();
        backPos      = this.transform.position;

        //Use preprocessor to get using platform
#if UNITY_STANDALONE
        platform = PLATFORM.STANDALONE;
        Debug.Log("UNITY_STANDALONE.STANDALONE");
#endif

#if UNITY_ANDROID
        platform = PLATFORM.PHONE;
#endif

#if UNITY_IPHONE
        platform = PLATFORM.PHONE;
        Debug.Log("UNITY_IPHONE.PHONE");
#endif

#if UNITY_EDITOR
        platform = PLATFORM.STANDALONE;
#endif
    }
    private void AddGameToConsole(GameData game, PLATFORM consolePlatform)
    {
        switch (consolePlatform)
        {
        case PLATFORM.NES:
        case PLATFORM.SNES:
        case PLATFORM.GB:
        case PLATFORM.GBA:
        case PLATFORM.N64:
        case PLATFORM.GAME_CUBE:
        case PLATFORM.DS:
        case PLATFORM.N3DS:
        case PLATFORM.WII:
        case PLATFORM.WIIU:
            nintendo.AddGame(consolePlatform, game);
            break;

        case PLATFORM.PS:
        case PLATFORM.PS2:
        case PLATFORM.PSP:
        case PLATFORM.PS3:
        case PLATFORM.PS4:
        case PLATFORM.PS_VITA:
            sony.AddGame(consolePlatform, game);
            break;

        case PLATFORM.XBOX:
        case PLATFORM.XBOX360:
        case PLATFORM.XBOXONE:
            microsoft.AddGame(consolePlatform, game);
            break;

        case PLATFORM.SEGA_GENESIS:
        case PLATFORM.SEGA_GAMEGEAR:
        case PLATFORM.SEGA_CD:
        case PLATFORM.SEGA_SATURN:
        case PLATFORM.SEGA_DREAMCAST:

            sega.AddGame(consolePlatform, game);
            break;

        case PLATFORM.PC:
            pc.AddGame(consolePlatform, game);
            break;

        case PLATFORM.ATARI2600:
        case PLATFORM.NEO_GEO:
        case PLATFORM.WONDER_SWAN:
        case PLATFORM.TG16:
        case PLATFORM._3DO:
        case PLATFORM.PCFX:
            other.AddGame(consolePlatform, game);
            break;

        default:
            Debug.LogError("Couldnt fit platform" + consolePlatform + " for game");
            break;
        }
    }
Esempio n. 5
0
 public GameObject GetCachedPlatform(PLATFORM plat)
 {
     if (cachedPlatforms.ContainsKey(plat))
     {
         return(cachedPlatforms[plat]);
     }
     return(null);
 }
 public AsaRun(string RunId, DateTime Timestamp, string Version, PLATFORM Platform, List <RESULT_TYPE> ResultTypes, RUN_TYPE Type)
 {
     this.RunId       = RunId;
     this.Timestamp   = Timestamp;
     this.Version     = Version;
     this.Platform    = Platform;
     this.ResultTypes = ResultTypes;
     this.Type        = Type;
 }
    public Platform(PLATFORM _platformType, string name)
    {
        gameYearComp = new GameDataYearComparer();

        games = new List <GameData>();

        platformType = _platformType;
        completeName = name;
    }
    public static void CreateAssetBundle_Character(string DestFolder, PLATFORM platform)
    {
        string mBatchPath = ASSETBUNDLE_PATH;

        ASSETBUNDLE_PATH = DestFolder + "/";

        CreateAssetBundle_Character(platform);

        ASSETBUNDLE_PATH = mBatchPath;
    }
Esempio n. 9
0
    public void RunABLoader()
    {
        PLATFORM = PlatForm.StandaloneWindows64;
        StartCoroutine(Initial_DownLoadAssetBundle(PLATFORM.ToString()));

        #region test code
        // StartCoroutine(LoadFromFile("a","Workshop Set"));
        //StartCoroutine(LoadFromFile("b", "Cube"));
        #endregion
    }
Esempio n. 10
0
        public Analyzer(PLATFORM platform, string filterLocation = "analyses.json", bool useEmbedded = false)
        {
            if (useEmbedded)
            {
                LoadEmbeddedFilters();
            }
            else
            {
                LoadFilters(filterLocation);
            }

            OsName = platform;
        }
    static void CreateAssetBundle_Image(PLATFORM platform)
    {
        CreateAssetBundlePath();

        List <Texture> imgs = CollectAll <Texture>("Assets/Resource/Texture");

        foreach (Texture t in imgs)
        {
            Debug.Log(t.name);
        }

        Log("CreateAssetbundles CreateAssetBundle_Image");
    }
    static void CreateAssetBundle_Sound(PLATFORM platform)
    {
        CreateAssetBundlePath();

        List <AudioSource> audios = CollectAll <AudioSource>("Assets/Resource/Sound");

        foreach (AudioSource t in audios)
        {
            Debug.Log(t.name);
        }

        Log("CreateAssetbundles CreateAssetBundle_Sound");
    }
        public Analyzer(PLATFORM platform, string filterLocation = null)
        {
            if (filterLocation == null)
            {
                LoadEmbeddedFilters();
            }
            else
            {
                LoadFilters(filterLocation);
            }

            OsName = platform;
        }
Esempio n. 14
0
        public Analyzer(PLATFORM platform, string?filterLocation = null)
        {
            config = new RuleFile();

            if (string.IsNullOrEmpty(filterLocation))
            {
                LoadEmbeddedFilters();
            }
            else
            {
                LoadFilters(filterLocation);
            }
            OsName = platform;
        }
Esempio n. 15
0
 public void AddGame(PLATFORM gamePlatform, GameData gameData)
 {
     //can be optimized with a binary search if the enum is in ascending order :-)
     for (int i = 0; i < platforms.Count; i++)
     {
         if (gamePlatform == platforms[i].PlatformType)
         {
             platforms[i].AddGame(gameData);
             return;
         }
     }
     Debug.LogError("Console " + consoleName +
                    " Doesnt have platform " + gamePlatform.ToString());
 }
    static void CreateAssetBundle_Text(PLATFORM platform)
    {
        CreateAssetBundlePath();

        List <TextAsset> texts = CollectAll <TextAsset>("Assets/Resource/Text");

        List <Object> toinclude = new List <Object>();

        foreach (TextAsset t in texts)
        {
            Debug.Log(t.name);
            toinclude.Add(t);
        }

        Log("CreateAssetbundles CreateAssetBundle_Text");
    }
Esempio n. 17
0
        static _Native()
        {
            string s = Environment.CommandLine;

            //last char of command line string
            s = s.Substring(s.Length - 1);

            switch (s)
            {
            case "e":             //exE
                CURRENT_PLATFORM = PLATFORM.W32;
                return;

            case "l":             //dlL
                CURRENT_PLATFORM = PLATFORM.EXT;
                return;

                //C for mac
                //4 for linux
            }
        }
    private void ParseFile()
    {
        TextAsset fileContents = Resources.Load(fileToLoadName) as TextAsset;

        string[] lines         = fileContents.text.Split(char.Parse("\n"));
        string   stringToParse = "";

        Debug.Log("Starting reading file contents");
        for (int i = 1; i < lines.Length; i++)
        {
            if (lines[i] == "")
            {
                continue;
            }
            stringToParse = lines[i];
            if (lines[i].Contains("\""))
            {
                stringToParse = RemoveCommasFromSubstring(lines[i]);
            }
            string[] dataValues = stringToParse.Split(char.Parse(","));
            GameData parsedGame = Utils.GenerateGame(dataValues[0] /*name*/, dataValues[2] /*year*/, dataValues[3] /*genre*/,
                                                     dataValues[4] /*publisher*/, dataValues[5] /*NASales*/,
                                                     dataValues[6] /*EUSales*/, dataValues[7] /*JPSales*/,
                                                     dataValues[8] /*OtherSales*/, dataValues[9] /*GlobalSales*/,
                                                     dataValues[10] /*criticScore*/, dataValues[11] /*criticCount*/,
                                                     dataValues[12] /*userScore*/, dataValues[13] /*userCount*/,
                                                     dataValues[14] /*Developer*/, dataValues[15] /*Rating*/);
            PLATFORM parsedPlatform = Utils.ConvertStrToPlatform(dataValues[1]);
            AddGameToConsole(parsedGame, parsedPlatform);
        }
        Debug.Log("Total games: " + lines.Length);
        Debug.Log("Finished reading file contents");
        nintendo.PrintInfo();
        sony.PrintInfo();
        microsoft.PrintInfo();
        sega.PrintInfo();
        pc.PrintInfo();
        other.PrintInfo();
    }
Esempio n. 19
0
        private void init()
        {
            //GameObject plat = (GameObject)GameObject.Instantiate(Resources.Load ("Prefab/" + oname));
            //plat.name = oname;
            GameObject plat = new GameObject("Platform");

            plat.AddComponent <PlatformCallback>();
            GameObject.DontDestroyOnLoad(plat);
#if UNITY_ANDROID
            type  = PLATFORM.Android;
            tools = new Android(oname);
            Debug.Log("kinside android");
#endif

#if UNITY_IPHONE
            type  = PLATFORM.iOS;
            tools = new iOS(oname);
            Debug.Log("kinside iOS");
#endif

#if UNITY_STANDALONE_WIN
#endif
        }
Esempio n. 20
0
    private void Start()
    {
        toolHub = GameObject.Find("ToolMenu").GetComponent <ToolHub>();

#if UNITY_STANDALONE
        platform = PLATFORM.STANDALONE;
        Debug.Log("UNITY_STANDALONE.STANDALONE");
#endif

#if UNITY_ANDROID
        platform = PLATFORM.PHONE;
        //Debug.Log("UNITY_ANDROID.PHONE");
#endif

#if UNITY_IPHONE
        platform = PLATFORM.PHONE;
        Debug.Log("UNITY_IPHONE.PHONE");
#endif

#if UNITY_EDITOR
        platform = PLATFORM.STANDALONE;
        //Debug.Log("UNITY_EDITOR.STANDALONE");
#endif
    }
Esempio n. 21
0
 public List <Rule> GetRulesForPlatform(PLATFORM platform)
 {
     return((List <Rule>)Rules.Where(x => x.Platforms.Contains(platform) || !x.Platforms.Any()));
 }
        static void CreateFromPrefab_Scene(PLATFORM p)
        {
            Debug.Log("CreateAssetbundles CreateFromPrefab_Scene");

            CreateAssetBundlePath();

            ArrayList listMatNames = new ArrayList();

            foreach (Object obj in Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets))
            {
                // filters
                if (!(obj is GameObject))
                    continue;
                //  
                GameObject characterClone = (GameObject)Object.Instantiate(obj);

                characterClone.name = obj.name;

                //  搜寻所有的MeshRender.
                foreach (MeshRenderer ren in characterClone.GetComponentsInChildren<MeshRenderer>())
                {
                    {
                        //  sharedMaterials
                        if (ren.sharedMaterials != null)
                        {
                            int count = ren.sharedMaterials.Length;

                            for (int i = count - 1; i >= 0; i--)
                            {
                                Material m = (Material)ren.sharedMaterials[i];

                                if (m == null)
                                    Debug.LogError("Missing " + obj.name + " -> Material");
                                else
                                {
                                    //Debug.Log(characterClone.name + "/" + ren.gameObject.name + "/" + m.name);

                                    StringPrefabMaterial prefabmat = new StringPrefabMaterial();
                                    //  资源名称.
                                    prefabmat.assetname = m.name;
                                    //  挂载的对象.
                                    prefabmat.meshrendererGameObject = ABTools.GetParentPath(ren.gameObject);
                                    //  资源对象.
                                    prefabmat.assetbundlePath = GetDepencyPath(m.name);

                                    listMatNames.Add(prefabmat);

                                }

                            }

                            ren.sharedMaterials = new Material[0];
                        }

                    }
                }

                //  创建一个不带Material的Prefab.
                Object o = PrefabUtility.CreateEmptyPrefab(ASSETBUNDLE_PATH + "/" + obj.name + "_nomaterial.prefab");
                PrefabUtility.ReplacePrefab(characterClone, o);

                //  创建配置文件
                StringPrefab holder = ScriptableObject.CreateInstance<StringPrefab>();
                holder.material = (StringPrefabMaterial[])listMatNames.ToArray(typeof(StringPrefabMaterial));
                AssetDatabase.CreateAsset(holder, ASSETBUNDLE_PATH + "/" + obj.name + "_material.asset");

                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();

                GameObject.DestroyImmediate(characterClone);
            }
        }
    public bool update_checksums(string user_id, string filename)
    {
        string line;
        string location   = string.Empty;
        int    PID        = 4;
        int    resolution = -1;
        string persona    = string.Empty;
        string branch     = string.Empty;

        StreamReader stream = new StreamReader(filename);

        try
        {
            do
            {
                MatchCollection matches;
                line = stream.ReadLine().Trim();

                if (branch == string.Empty)
                {
                    // # branch : firmware-6
                    matches = Regex.Matches(line, "#\\s*branch\\s*:\\s*(?<branch>.*)$", RegexOptions.IgnoreCase);
                    foreach (Match match in matches)
                    {
                        branch = match.Groups["branch"].Value;
                        break;
                    }
                }

                if (location == string.Empty)
                {
                    // # location : /m/tcases/futures/next/wip/
                    matches = Regex.Matches(line, "#\\s*location\\s*:\\s*(?<location>.*)$", RegexOptions.IgnoreCase);
                    foreach (Match match in matches)
                    {
                        location = match.Groups["location"].Value;
                        break;
                    }
                }

                if (persona == string.Empty)
                {
                    matches = Regex.Matches(line, "#\\s*persona\\s*:\\s*(?<persona>.*)$", RegexOptions.IgnoreCase);
                    foreach (Match match in matches)
                    {
                        persona = match.Groups["persona"].Value;
                        break;
                    }
                }

                if (-1 == resolution)
                {
                    matches = Regex.Matches(line, "#\\s*resolution\\s*:\\s*(?<resolution>.*)$", RegexOptions.IgnoreCase);
                    if (1 == matches.Count)
                    {
                        resolution = Int32.Parse(matches[0].Groups["resolution"].Value);
                        break;
                    }
                }
            }while (line == string.Empty || line.StartsWith("#"));

            PLATFORM platform_table = new PLATFORM();
            PID = platform_table.lookup_pid(branch, persona, resolution);

            return(update_checksums(user_id, PID, location, stream));
        }
        finally
        {
            stream.Close();
        }
    }
    static void CreateAssetBundle_Character(PLATFORM platform)
    {
        Log("CreateAssetbundles CreateAssetBundle_Characters");

        int processedBundleCount = 0;

        CreateAssetBundlePath();
        //		AssetDatabase.DeleteAsset(ASSETBUNDLE_PATH);
        //		AssetDatabase.DeleteAsset(TEMP_PREFAB_PATH);

        foreach (Object obj in Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets))
        {
            // filters
            if (!(obj is GameObject))
            {
                continue;
            }
            if (obj.name.Contains("@"))
            {
                continue;
            }
            if (!AssetDatabase.GetAssetPath(obj).Contains("Model"))
            {
                continue;
            }

            if (AssetDatabase.GetAssetPath(obj).Contains("Female"))
            {
                continue;
            }

            /*
             * Assets/Resource/Model/Characters/Female
             * Assets/Resource/Model/Characters/Female/Female.fbx
             * Assets/Resource/Model/Characters/Female/Anim/
             * Assets/Resource/Model/Characters/Female/PerTextureMaterials/
             * Assets/Resource/Model/Characters/Female/textures/
             *
             */

            string fullpath = AssetDatabase.GetAssetPath(obj);
            string rootpath = fullpath.Substring(0, fullpath.LastIndexOf('/') + 1);

            string materialpath = rootpath + MATERIAL_PATH;
            string animpath     = rootpath + ANIMATION_PATH;
            string texturepath  = rootpath + TEXTURE_PATH;

            GameObject characterFBX = (GameObject)obj;
            string     name         = characterFBX.name.ToLower();

            DeleteExistAssetbundle(name + "_characterbase");

            if (name.Contains("_"))
            {
                Debug.LogError("fbx name is illegal: " + name);
            }

            string log = "-----------------\n";

            log += ("Create AssetBundle for [ " + name + " ] \tPath: " + fullpath + "\n");

            // fbx
            //			if(false)
            {
                log += "Prepare FBX: \n";

                log += ("\tName: " + name + "\n");

                GameObject characterClone = (GameObject)Object.Instantiate(characterFBX);

                // remove animation
                foreach (Animation anim in characterClone.GetComponentsInChildren <Animation>())
                {
                    GameObject.DestroyImmediate(anim);
                }

                // delete skinned mesh
                bool skinned = false;
                foreach (SkinnedMeshRenderer smr in characterClone.GetComponentsInChildren <SkinnedMeshRenderer>())
                {
                    skinned = true;
                    Object.DestroyImmediate(smr.gameObject);
                }

                //				foreach(MeshRenderer smr in characterClone.GetComponentsInChildren<MeshRenderer>())
                //					Object.DestroyImmediate(smr.gameObject);

                //				if(skinned)
                //					characterClone.AddComponent<SkinnedMeshRenderer>();

                // save asset bundle
                string path   = ASSETBUNDLE_PATH + name + "_characterbase" + ASSETBUNDLE_SUFFIX;
                Object prefab = GetPrefab(characterClone, "characterbase");

                bool result = false;
                if (platform == PLATFORM.Win)
                {
                    result = BuildPipeline.BuildAssetBundle(prefab, null, path, BuildAssetBundleOptions.CollectDependencies, BuildTarget.StandaloneWindows);
                }
                else if (platform == PLATFORM.iOS)
                {
                    result = BuildPipeline.BuildAssetBundle(prefab, null, path, BuildAssetBundleOptions.CollectDependencies, BuildTarget.iOS);
                }
                else if (platform == PLATFORM.Android)
                {
                    result = BuildPipeline.BuildAssetBundle(prefab, null, path, BuildAssetBundleOptions.CollectDependencies, BuildTarget.Android);
                }

                if (!result)
                {
                    Debug.LogWarning("Failed! Create AssetBundle: " + path);
                }
                //				else
                //					Debug.Log("Success! Create AssetBundle: " + path);

                ++processedBundleCount;

                // delete prefab
                AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(prefab));
            }

            // mesh

            bool findSkinnedMeshRenderer = false;
            log += "Prepare Mesh: \n";

            //			if(false)
            {
                List <Material> materials = CollectAll <Material>(materialpath);

                foreach (SkinnedMeshRenderer smr in characterFBX.GetComponentsInChildren <SkinnedMeshRenderer>(true))
                {
                    List <Object> toinclude = new List <Object>();

                    // skinned mesh
                    GameObject rendererClone  = (GameObject)EditorUtility.InstantiatePrefab(smr.gameObject);
                    GameObject rendererParent = rendererClone.transform.parent.gameObject;
                    rendererClone.transform.parent = null;
                    Object.DestroyImmediate(rendererParent);
                    Object renderPrefab = GetPrefab(rendererClone, "rendererobject");
                    toinclude.Add(renderPrefab);

                    // material
                    log += ("\tMesh: " + smr.name + "\n");

                    log += "\t\tMaterial: \n";

                    foreach (Material m in materials)
                    {
                        if (m.name.Contains(smr.name.ToLower()))
                        {
                            toinclude.Add(m);

                            log += ("\t\t" + m.name + "\n");
                        }
                    }

                    log += "\tBones: \n";

                    // bone assemble information
                    List <string> boneNames = new List <string>();
                    foreach (Transform t in smr.bones)
                    {
                        boneNames.Add(t.name);
                    }

                    StringHolder holder = ScriptableObject.CreateInstance <StringHolder>();
                    holder.content = boneNames.ToArray();
                    AssetDatabase.CreateAsset(holder, STRING_HOLDER_PATH);
                    toinclude.Add(AssetDatabase.LoadAssetAtPath(STRING_HOLDER_PATH, typeof(StringHolder)));

                    // save the assetbundle
                    string bundleName = smr.name.ToLower();
                    string path       = ASSETBUNDLE_PATH + bundleName + ASSETBUNDLE_SUFFIX;

                    bool result = false;
                    if (platform == PLATFORM.Win)
                    {
                        result = BuildPipeline.BuildAssetBundle(null, toinclude.ToArray(), path, BuildAssetBundleOptions.CollectDependencies, BuildTarget.StandaloneWindows);
                    }
                    else if (platform == PLATFORM.iOS)
                    {
                        result = BuildPipeline.BuildAssetBundle(null, toinclude.ToArray(), path, BuildAssetBundleOptions.CollectDependencies, BuildTarget.iOS);
                    }
                    else if (platform == PLATFORM.Android)
                    {
                        result = BuildPipeline.BuildAssetBundle(null, toinclude.ToArray(), path, BuildAssetBundleOptions.CollectDependencies, BuildTarget.Android);
                    }

                    if (!result)
                    {
                        Debug.LogWarning("Failed! Create AssetBundle: " + path);
                    }
                    //					else
                    //						Debug.Log("Success! Create AssetBundle: " + path);

                    ++processedBundleCount;

                    // delete temp assets
                    AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(renderPrefab));
                    AssetDatabase.DeleteAsset(STRING_HOLDER_PATH);

                    findSkinnedMeshRenderer = true;
                }
            }

            if (!findSkinnedMeshRenderer)
            {
                List <Material> materials = CollectAll <Material>(materialpath);

                foreach (MeshRenderer smr in characterFBX.GetComponentsInChildren <MeshRenderer>(true))
                {
                    List <Object> toinclude = new List <Object>();

                    // skinned mesh
                    GameObject rendererClone  = (GameObject)EditorUtility.InstantiatePrefab(smr.gameObject);
                    GameObject rendererParent = rendererClone.transform.parent.gameObject;
                    rendererClone.transform.parent = null;
                    Object.DestroyImmediate(rendererParent);
                    Object renderPrefab = GetPrefab(rendererClone, "rendererobject");
                    toinclude.Add(renderPrefab);

                    // material
                    log += ("\tMesh: " + smr.name + "\n");

                    log += "\t\tMaterial: \n";

                    foreach (Material m in materials)
                    {
                        if (m.name.Contains(smr.name.ToLower()))
                        {
                            toinclude.Add(m);

                            log += ("\t\t" + m.name + "\n");
                        }
                    }

                    // save the assetbundle
                    string bundleName = smr.name.ToLower();
                    string path       = ASSETBUNDLE_PATH + bundleName + ASSETBUNDLE_SUFFIX;

                    bool result = false;
                    if (platform == PLATFORM.Win)
                    {
                        result = BuildPipeline.BuildAssetBundle(null, toinclude.ToArray(), path, BuildAssetBundleOptions.CollectDependencies, BuildTarget.StandaloneWindows);
                    }
                    else if (platform == PLATFORM.iOS)
                    {
                        result = BuildPipeline.BuildAssetBundle(null, toinclude.ToArray(), path, BuildAssetBundleOptions.CollectDependencies, BuildTarget.iOS);
                    }
                    else if (platform == PLATFORM.Android)
                    {
                        result = BuildPipeline.BuildAssetBundle(null, toinclude.ToArray(), path, BuildAssetBundleOptions.CollectDependencies, BuildTarget.Android);
                    }

                    if (!result)
                    {
                        Debug.LogWarning("Failed! Create AssetBundle: " + path);
                    }
                    //					else
                    //						Debug.Log("Success! Create AssetBundle: " + path);

                    ++processedBundleCount;

                    // delete temp assets
                    AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(renderPrefab));
                    AssetDatabase.DeleteAsset(STRING_HOLDER_PATH);
                }
            }

            // animation
            {
                log += "Prepare Animation: \n";

                if ((Directory.Exists(animpath) && fullpath.IndexOf("_") == -1) ||
                    (Directory.Exists(animpath) && fullpath.IndexOf("wing") != -1))
                {
                    List <AnimationClip> acs       = CollectAll <AnimationClip>(animpath);
                    List <Object>        toinclude = new List <Object>();
                    List <string>        animNames = new List <string>();

                    foreach (AnimationClip ac in acs)
                    {
                        toinclude.Add(ac);
                        animNames.Add(ac.name);

                        log += ("\t" + ac.name + "\n");
                    }

                    // animation information
                    StringHolder holder = ScriptableObject.CreateInstance <StringHolder>();
                    holder.content = animNames.ToArray();
                    AssetDatabase.CreateAsset(holder, STRING_HOLDER_PATH);
                    toinclude.Add(AssetDatabase.LoadAssetAtPath(STRING_HOLDER_PATH, typeof(StringHolder)));

                    // save the assetbundle
                    string bundleName = name + "_animations";
                    string path       = ASSETBUNDLE_PATH + bundleName + ASSETBUNDLE_SUFFIX;

                    bool result = false;
                    if (platform == PLATFORM.Win)
                    {
                        result = BuildPipeline.BuildAssetBundle(null, toinclude.ToArray(), path, BuildAssetBundleOptions.CollectDependencies, BuildTarget.StandaloneWindows);
                    }
                    else if (platform == PLATFORM.iOS)
                    {
                        result = BuildPipeline.BuildAssetBundle(null, toinclude.ToArray(), path, BuildAssetBundleOptions.CollectDependencies, BuildTarget.iOS);
                    }
                    else if (platform == PLATFORM.Android)
                    {
                        result = BuildPipeline.BuildAssetBundle(null, toinclude.ToArray(), path, BuildAssetBundleOptions.CollectDependencies, BuildTarget.Android);
                    }

                    if (!result)
                    {
                        Debug.LogWarning("Failed! Create AssetBundle: " + path);
                    }
                    //					else
                    //						Debug.Log("Success! Create AssetBundle: " + path);

                    ++processedBundleCount;

                    AssetDatabase.DeleteAsset(STRING_HOLDER_PATH);
                }
            }

            ++processedBundleCount;

            log += "-----------------\n";

            Log(log);
        }

        if (processedBundleCount == 0)
        {
            //EditorUtility.DisplayDialog("AssetBundle Generator", "[ " + processedBundleCount + " ] been created. Select the Resource/Model/ folder to build assetbundle.", "OK");
            Debug.Log("AssetBundle Generator" + "[ " + processedBundleCount + " ] been created. Select the Resource/Model/ folder to build assetbundle.");
        }
        else
        {
            //			UpdateCharacterElementDatabase.Update();
            //EditorUtility.DisplayDialog("AssetBundle Generator", "[ " + processedBundleCount + " ] been created.", "OK");
            Debug.Log("AssetBundle Generator" + "[ " + processedBundleCount + " ] been created.");
        }
    }
Esempio n. 25
0
 public Analyzer(PLATFORM platform, RuleFile filters)
 {
     OsName = platform;
     config = filters;
 }
 public static void CreateFromPrefab_Scene(string DestFolder, PLATFORM p)
 {
 }
Esempio n. 27
0
    public static PLATFORM ConvertStrToPlatform(string s)
    {
        PLATFORM detectedPlatform = PLATFORM.UNKNOWN;

        switch (s.Trim())
        {
        case "NES":
            detectedPlatform = PLATFORM.NES;
            break;

        case "SNES":
            detectedPlatform = PLATFORM.SNES;
            break;

        case "GB":
            detectedPlatform = PLATFORM.GB;
            break;

        case "GBA":
            detectedPlatform = PLATFORM.GBA;
            break;

        case "DS":
            detectedPlatform = PLATFORM.DS;
            break;

        case "3DS":
            detectedPlatform = PLATFORM.N3DS;
            break;

        case "N64":
            detectedPlatform = PLATFORM.N64;
            break;

        case "GC":
            detectedPlatform = PLATFORM.GAME_CUBE;
            break;

        case "Wii":
            detectedPlatform = PLATFORM.WII;
            break;

        case "WiiU":
            detectedPlatform = PLATFORM.WIIU;
            break;

        case "PS":
            detectedPlatform = PLATFORM.PS;
            break;

        case "PS2":
            detectedPlatform = PLATFORM.PS2;
            break;

        case "PS3":
            detectedPlatform = PLATFORM.PS3;
            break;

        case "PS4":
            detectedPlatform = PLATFORM.PS4;
            break;

        case "PSP":
            detectedPlatform = PLATFORM.PSP;
            break;

        case "PSV":
            detectedPlatform = PLATFORM.PS_VITA;
            break;

        case "XB":
            detectedPlatform = PLATFORM.XBOX;
            break;

        case "X360":
            detectedPlatform = PLATFORM.XBOX360;
            break;

        case "XOne":
            detectedPlatform = PLATFORM.XBOXONE;
            break;

        case "SAT":
            detectedPlatform = PLATFORM.SEGA_SATURN;
            break;

        case "SCD":
            detectedPlatform = PLATFORM.SEGA_CD;
            break;

        case "GEN":
            detectedPlatform = PLATFORM.SEGA_GENESIS;
            break;

        case "DC":
            detectedPlatform = PLATFORM.SEGA_DREAMCAST;
            break;

        case "GG":
            detectedPlatform = PLATFORM.SEGA_GAMEGEAR;
            break;

        case "PC":
            detectedPlatform = PLATFORM.PC;
            break;

        case "2600":
            detectedPlatform = PLATFORM.ATARI2600;
            break;

        case "WS":
            detectedPlatform = PLATFORM.WONDER_SWAN;
            break;

        case "NG":
            detectedPlatform = PLATFORM.NEO_GEO;
            break;

        case "TG16":
            detectedPlatform = PLATFORM.TG16;
            break;

        case "3DO":
            detectedPlatform = PLATFORM._3DO;
            break;

        case "PCFX":
            detectedPlatform = PLATFORM.PCFX;
            break;

        default:
            Debug.LogError("Unknown platform " + s);
            detectedPlatform = PLATFORM.UNKNOWN;
            break;
        }
        return(detectedPlatform);
    }
        static void CreateFromPrefab_Scene(PLATFORM p)
        {
            Debug.Log("CreateAssetbundles CreateFromPrefab_Scene");

            CreateAssetBundlePath();

            ArrayList listMatNames = new ArrayList();

            foreach (Object obj in Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets))
            {
                // filters
                if (!(obj is GameObject))
                {
                    continue;
                }
                //
                GameObject characterClone = (GameObject)Object.Instantiate(obj);

                characterClone.name = obj.name;

                //  搜寻所有的MeshRender.
                foreach (MeshRenderer ren in characterClone.GetComponentsInChildren <MeshRenderer>())
                {
                    {
                        //  sharedMaterials
                        if (ren.sharedMaterials != null)
                        {
                            int count = ren.sharedMaterials.Length;

                            for (int i = count - 1; i >= 0; i--)
                            {
                                Material m = (Material)ren.sharedMaterials[i];

                                if (m == null)
                                {
                                    Debug.LogError("Missing " + obj.name + " -> Material");
                                }
                                else
                                {
                                    //Debug.Log(characterClone.name + "/" + ren.gameObject.name + "/" + m.name);

                                    StringPrefabMaterial prefabmat = new StringPrefabMaterial();
                                    //  资源名称.
                                    prefabmat.assetname = m.name;
                                    //  挂载的对象.
                                    prefabmat.meshrendererGameObject = ABTools.GetParentPath(ren.gameObject);
                                    //  资源对象.
                                    prefabmat.assetbundlePath = GetDepencyPath(m.name);

                                    listMatNames.Add(prefabmat);
                                }
                            }

                            ren.sharedMaterials = new Material[0];
                        }
                    }
                }

                //  创建一个不带Material的Prefab.
                Object o = PrefabUtility.CreateEmptyPrefab(ASSETBUNDLE_PATH + "/" + obj.name + "_nomaterial.prefab");
                PrefabUtility.ReplacePrefab(characterClone, o);

                //  创建配置文件
                StringPrefab holder = ScriptableObject.CreateInstance <StringPrefab>();
                holder.material = (StringPrefabMaterial[])listMatNames.ToArray(typeof(StringPrefabMaterial));
                AssetDatabase.CreateAsset(holder, ASSETBUNDLE_PATH + "/" + obj.name + "_material.asset");

                GameObject.DestroyImmediate(characterClone);
            }
        }
Esempio n. 29
0
 internal Row(DataRowBuilder rb) : base(rb)
 {
     this.table = ((PLATFORM)(this.Table));
 }
        public static void CreateFromPrefab_Scene(string DestFolder, PLATFORM p)
        {

        }
Esempio n. 31
0
        static void Main(string[] args)
        {
            oval_model.Configuration.AutoDetectChangesEnabled = false;
            oval_model.Configuration.ValidateOnSaveEnabled    = false;

            //string sOVALDefinitionIDPattern="oval:org.mitre.oval:def:9999"; //HARDCODED
            string sOVALDefinitionIDPattern = "oval:org.mitre.oval:def:7878";

            //string sVersion="5";

            OVALDEFINITION oOVALDefinition = oval_model.OVALDEFINITION.Where(o => o.OVALDefinitionIDPattern == sOVALDefinitionIDPattern).OrderByDescending(o => o.OVALDefinitionVersion).FirstOrDefault();

            if (oOVALDefinition == null)
            {
                Console.WriteLine("DEBUG " + DateTimeOffset.Now);
                Console.WriteLine("ERROR OVALDEFINITION not found");
                return;
            }
            else
            {
                Console.WriteLine("Definition Id: " + oOVALDefinition.OVALDefinitionIDPattern);
                Console.WriteLine("Version: " + oOVALDefinition.OVALDefinitionVersion);
                //Last Modified
                Console.WriteLine("Title: " + oOVALDefinition.OVALDefinitionTitle);
                Console.WriteLine("Description: " + oOVALDefinition.OVALDefinitionDescription);
                int iOVALDefinitionFamilyID = oval_model.OVALDEFINITIONFAMILY.FirstOrDefault(o => o.OVALDefinitionID == oOVALDefinition.OVALDefinitionID).OVALDefinitionFamilyID;
                int iOSFamilyID             = (int)oval_model.OVALDEFINITIONFAMILY.FirstOrDefault(o => o.OVALDefinitionFamilyID == iOVALDefinitionFamilyID).OSFamilyID;

                //Console.WriteLine("Family: "+oOVALDefinition.OVALDEFINITIONFAMILY.FirstOrDefault().OSFAMILY.FamilyName);
                Console.WriteLine("Family: " + model.OSFAMILY.FirstOrDefault(o => o.OSFamilyID == iOSFamilyID).FamilyName);

                Console.WriteLine("Class: " + oOVALDefinition.OVALCLASSENUMERATION.ClassValue);
                Console.WriteLine("Status: " + oOVALDefinition.StatusName);
                //References:

                //TODO
                //foreach(OVALDEFINITIONVULNERABILITY oOVALDefVuln in oOVALDefinition.OVALDEFINITIONVULNERABILITY)

                Console.WriteLine("Platform(s): ");
                foreach (OVALDEFINITIONPLATFORM oOVALDefPlatform in oOVALDefinition.OVALDEFINITIONPLATFORM)
                {
                    //Console.WriteLine(oOVALDefPlatform.PLATFORM.PlatformName);
                    //Search the PlatformName
                    try
                    {
                        PLATFORM oPlatform = model.PLATFORM.Where(o => o.PlatformID == oOVALDefPlatform.PlatformID).FirstOrDefault();
                        if (oPlatform != null)
                        {
                            Console.WriteLine("DEBUG PlatformName=" + oPlatform.PlatformName);
                        }
                    }
                    catch (Exception exPlatformName)
                    {
                    }
                }

                Console.WriteLine("Product(s): ");
                foreach (OVALDEFINITIONCPE oOVALDefCPE in oOVALDefinition.OVALDEFINITIONCPE)
                {
                    //Console.WriteLine(oOVALDefCPE.CPE.CPEName);
                    try
                    {
                        string sCPEName = model.CPE.FirstOrDefault(o => o.CPEID == oOVALDefCPE.CPEID).CPEName;
                        Console.WriteLine(sCPEName);
                    }
                    catch (Exception exCPEName)
                    {
                        Console.WriteLine("Exceptiion exCPEName " + exCPEName.Message + " " + exCPEName.InnerException);
                    }
                }



                Console.WriteLine("Definition Synopsis: ");
                //Console.WriteLine(oOVALDefinition.OVALCRITERIA.OPERATORENUMERATION.OperatorValue+" "+oOVALDefinition.OVALCRITERIA.comment);
                //Console.WriteLine(oOVALDefinition.OVALCRITERIA.OPERATORENUMERATION.OperatorValue);

                fDisplayCriteria(oOVALDefinition.OVALCriteriaID.Value);
            }
        }
Esempio n. 32
0
 public Analyzer(PLATFORM platform) : this(platform : platform, useEmbedded : true)
 {
 }