private void LoadDefaultStyle(AssetLoader loader, AssetLibrary library, Painter painter)
        {
            loader.ForceLoadAsset("images/button-ninepatches");
            loader.ForceLoadAsset("images/window");
            loader.ForceLoadAsset("fonts/DefaultFontSmall");

            library.AddMachinaAsset("ui-button",
                                    new NinepatchSheet("button-ninepatches", new Rectangle(0, 0, 24, 24), new Rectangle(8, 8, 8, 8), painter));
            library.AddMachinaAsset("ui-button-hover",
                                    new NinepatchSheet("button-ninepatches", new Rectangle(24, 0, 24, 24),
                                                       new Rectangle(8 + 24, 8, 8, 8), painter));
            library.AddMachinaAsset("ui-button-press",
                                    new NinepatchSheet("button-ninepatches", new Rectangle(48, 0, 24, 24),
                                                       new Rectangle(8 + 48, 8, 8, 8), painter));
            library.AddMachinaAsset("ui-slider-ninepatch",
                                    new NinepatchSheet("button-ninepatches", new Rectangle(0, 144, 24, 24),
                                                       new Rectangle(8, 152, 8, 8), painter));
            library.AddMachinaAsset("ui-checkbox-checkmark-image",
                                    new Image(new GridBasedSpriteSheet("button-ninepatches", new Point(24, 24)), 6));
            library.AddMachinaAsset("ui-radio-fill-image",
                                    new Image(new GridBasedSpriteSheet("button-ninepatches", new Point(24, 24)), 7));
            library.AddMachinaAsset("ui-checkbox-radio-spritesheet",
                                    new GridBasedSpriteSheet("button-ninepatches", new Point(24, 24)));
            library.AddMachinaAsset("ui-textbox-ninepatch",
                                    new NinepatchSheet("button-ninepatches", new Rectangle(0, 96, 24, 24),
                                                       new Rectangle(8, 104, 8, 8), painter));
            library.AddMachinaAsset("ui-window-ninepatch",
                                    new NinepatchSheet("window", new Rectangle(0, 0, 96, 96), new Rectangle(10, 34, 76, 52), painter));

            MachinaClient.SetupDefaultStyle();
        }
Example #2
0
    /// <summary>
    /// 解析读取属性信息
    /// </summary>
    /// <param name="br"></param>
    public void Read(BinaryReader br)
    {
        this.ambienceSamplerID = br.ReadInt32();
        this.height            = br.ReadSingle();
        this.waveSpeed.x       = br.ReadSingle();
        this.waveSpeed.y       = br.ReadSingle();
        this.waveSpeed.z       = br.ReadSingle();
        this.waveSpeed.w       = br.ReadSingle();
        this.waveScale         = br.ReadSingle();
        this.horizonColor      = new Color(br.ReadSingle(), br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
        this.waterVisibleDepth = br.ReadSingle();
        this.waterDiffValue    = br.ReadSingle();
        long position = br.BaseStream.Position;

        if (br.ReadInt32() == 10015)
        {
            this.alpha = br.ReadSingle();
        }
        else
        {
            br.BaseStream.Position = position;
        }
        this.depthMapPath     = br.ReadString();
        this.colorControlPath = br.ReadString();
        this.waterBumpMapPath = br.ReadString();
        this.colorControlMap  = AssetLibrary.Load(this.colorControlPath, AssetType.Texture2D, LoadType.Type_Resources).texture2D;
        this.bumpMap          = AssetLibrary.Load(this.waterBumpMapPath, AssetType.Texture2D, LoadType.Type_Resources).texture2D;
        this.depthMap         = AssetLibrary.Load(this.depthMapPath, AssetType.Texture2D, LoadType.Type_Auto).texture2D;
    }
Example #3
0
        public async Task FetchAssetOnly()
        {
            AssetLibrary assetLibrary             = client.AssetLibrary().Only(new string[] { "url" });
            ContentstackCollection <Asset> assets = await assetLibrary.FetchAll();

            if (assets == null)
            {
                Assert.False(true, "Query.Exec is not match with expected result.");
            }
            else if (assets != null)
            {
                foreach (Asset asset in assets)
                {
                    Assert.DoesNotContain(asset.Url, "http");
                    Assert.Null(asset.Description);
                    Assert.Null(asset.FileSize);
                    Assert.Null(asset.Tags);
                    Assert.Null(asset.Description);
                }
            }
            else
            {
                Assert.False(true, "Result doesn't mathced the count.");
            }
        }
Example #4
0
 public static void RemoveAsset(Asset asset)
 {
     if (asset != null)
     {
         AssetLibrary.getBundle().RemoveAsset(asset);
     }
 }
Example #5
0
 /// <summary>
 /// 开启显示
 /// </summary>
 public void Visible()
 {
     if (LightmapSettings.lightmaps.Length > 0 && (this._lightmapPrototype.lightmapIndex == 255 || this._lightmapPrototype.lightmapIndex == -1))
     {
         this.visible = true;
         return;
     }
     if (!this.visible)
     {
         //创建显示水体
         if (this.waterData != null && this.water == null)
         {
             this.water = Water.CreateWaterGameObject(this.waterData);
             this.water.gameObject.name    = "water" + this.key;
             this.water.transform.position = new Vector3(this.position.x, this.water.waterData.height, this.position.z);
         }
         TerrainConfig terrainConfig = this.region.scene.terrainConfig;
         //创建显示地形
         if (terrainConfig.enableTerrain)
         {
             if (this.terrain == null)                    //没有先加载,完成加载进行显示
             {
                 Asset asset;
                 if (this.region.scene.loadFromAssetBund)
                 {
                     asset = AssetLibrary.Load(this.path + "_terrainData", AssetType.Terrain, LoadType.Type_AssetBundle);
                 }
                 else
                 {
                     asset = AssetLibrary.Load(this.path + "_terrainData", AssetType.Terrain, LoadType.Type_Resources);
                 }
                 if (asset != null)
                 {
                     if (asset.loaded)
                     {
                         this.OnTerrainLoadCompate(asset);
                     }
                     else
                     {
                         asset.loadedListener = new Asset.LoadedListener(this.OnTerrainLoadCompate);
                     }
                     if (!GameScene.isPlaying && !asset.loaded)
                     {
                         this.OnTerrainLoadCompate(asset);
                     }
                 }
             }
             else                   //已有地形直接显示
             {
                 this.terrain.gameObject.SetActive(true);
             }
             if (this.water != null)
             {
                 this.water.gameObject.SetActive(true);
             }
         }
     }
     this.visible = true;
 }
Example #6
0
    public void ParseMainMaterial()
    {
        string    path      = this.br.ReadString();
        Texture2D texture2D = AssetLibrary.Load(path, AssetType.Texture2D, LoadType.Type_Resources).texture2D;

        this.mat             = new Material(SkinnedMeshParser.skmShader);
        this.mat.mainTexture = texture2D;
    }
Example #7
0
        public async Task <string> FetchAssetUID()
        {
            AssetLibrary assetLibrary             = client.AssetLibrary();
            ContentstackCollection <Asset> assets = await assetLibrary.FetchAll();

            Assert.True(assets.Count() > 0);
            return(assets.First <Asset>().Uid);
        }
        public void Setup()
        {
            View.Icon.sprite = AssetLibrary.GetSpriteByPath(Model.Data.Icon);
            View.Name.text   = Model.Data.Name;

            Model.EventChanged += OnChanged;
            OnChanged();
        }
        // ! Setta la texture
        public static void setTexture(PartDocument oDoc)
        {
            SheetMetalComponentDefinition oCompDef = (SheetMetalComponentDefinition)oDoc.ComponentDefinition;

            FaceCollection fcFront = oCompDef.Bends[1].FrontFaces[1].TangentiallyConnectedFaces;

            fcFront.Add(oCompDef.Bends[1].FrontFaces[1]);

            FaceCollection fcBack = oCompDef.Bends[1].BackFaces[1].TangentiallyConnectedFaces;

            fcBack.Add(oCompDef.Bends[1].BackFaces[1]);

            double area0 = 0;

            foreach (Face oFace in fcFront)
            {
                area0 = area0 + oFace.Evaluator.Area;
            }

            double area1 = 0;

            foreach (Face oFace in fcBack)
            {
                area1 = area1 + oFace.Evaluator.Area;
            }

            Asset oAsset;

            try
            {
                oAsset = oDoc.Assets["RawSide"];
            }
            catch (System.ArgumentException e)
            {
                Assets oAssets = oDoc.Assets;

                AssetLibrary oAssetsLib = iApp.AssetLibraries["3D_Pisa_Col"];
                Asset        oAssetLib  = oAssetsLib.AppearanceAssets["RawSide"];

                oAsset = oAssetLib.CopyTo(oDoc);
            }

            FaceCollection fc;

            if (area0 > area1)
            {
                fc = fcBack;
            }
            else
            {
                fc = fcFront;
            }

            foreach (Face f in fc)
            {
                f.Appearance = oAsset;
            }
        }
        /// <summary>
        /// Create library of graphic assets.
        /// </summary>
        /// <returns>Library.</returns>
        protected override AssetLibrary GetAssetLibrary()
        {
            AssetLibrary lib = AssetLibrary.CreateAnEmptyLibrary();             // New asset library.
            X2DAsset     A   = null;                                            // Temporary variable used to create graphic assets.

            // Create a new graphic asset  for the aquarium visuals using class X2DAsset.
            A = new X2DAsset("AquariumVisuals", "AquariumBackground").
                UVOriginAt(400, 300).
                UVTopLeftCornerAt(0, 0).
                Width(800).
                Height(600);

            // Import aquarium visual asset in the library.
            lib.ImportAsset(A);

            // Create a new graphic asset for the first progress marker visuals using class X2DAsset.
            A = new X2DAsset("ChickenLegVisuals", "ChickenLeg").
                UVOriginAt(64, 64).
                UVTopLeftCornerAt(0, 0).
                Width(128).
                Height(128);

            // Import first marker visual asset in the library
            lib.ImportAsset(A);

            // Create a new graphic asset  for the orange fish visuals using class X2DAsset.
            A = new X2DAsset("OrangeFishVisuals", "OrangeFish").
                UVOriginAt(64, 64).
                UVTopLeftCornerAt(0, 0).
                Width(128).
                Height(84);

            // Import orange fish visual asset in the library
            lib.ImportAsset(A);

            //Imports the first Piranha visual
            A = new X2DAsset("PiranhaVisuals1", "Piranha1").
                UVOriginAt(64, 64).
                UVTopLeftCornerAt(0, 0).
                Width(128).
                Height(128);

            // Import into library
            lib.ImportAsset(A);

            // Imports the second Piranha visual - Didn't work as intended so idea scrapped, left in if alternative found later
            A = new X2DAsset("PiranhaVisuals2", "Piranha2").
                UVOriginAt(64, 64).
                UVTopLeftCornerAt(0, 0).
                Width(128).
                Height(128);

            // Import into library
            lib.ImportAsset(A);

            // Return library.
            return(lib);
        }
Example #11
0
 public static void LoadLibrary()
 {
     Library = new AssetLibrary();
     try
     {
         Load.Library();
     }
     catch { }
 }
 public void ApplyActiveUserThemeStyle(SceneViewModel viewModel)
 {
     for (int index = 0; index < this.records.Count; ++index)
     {
         CanvasLikeDataViewLayoutBuilder.LabelField labelField = this.records[index];
         AssetLibrary.ApplyActiveUserThemeStyle(viewModel.GetSceneNode(labelField.Label));
         AssetLibrary.ApplyActiveUserThemeStyle(viewModel.GetSceneNode(labelField.Field));
     }
 }
Example #13
0
 void Application_Start(object sender, EventArgs e)
 {
     _Library  = new AssetLibrary();
     _Settings = new XmlDocument();
     _Settings.Load(Server.MapPath("~/App_Data/settings.xml"));
     // Code that runs on application startup
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
 }
    private void Awake()
    {
        DataLibrary.Insert(AssetLibrary.GetTextByPath("Configs/Resources.json").text);

        _network   = new GameNetworkMock();
        _model     = new GameModel(_network);
        _presenter = new GamePresenter(_model);
        _presenter.Attach(_view);
    }
Example #15
0
    public static void RemoveAsset(string path)
    {
        Asset asset = AssetLibrary.getBundle().GetAsset(path);

        if (asset != null)
        {
            AssetLibrary.getBundle().RemoveAsset(asset);
        }
    }
Example #16
0
        public void TurnBlue()
        {
            // Get the active document
            PartDocument doc        = (PartDocument)m_inventorApplication.ActiveDocument;
            AssetLibrary lib        = m_inventorApplication.AssetLibraries["Autodesk Appearance Library"];
            Asset        libAsset   = lib.AppearanceAssets["Blue - Wall Paint - Glossy"];
            Asset        localAsset = libAsset.CopyTo(doc);

            doc.ActiveAppearance = localAsset;
        }
Example #17
0
    public static void AddAsset(string path, Asset asset)
    {
        Asset asset2 = AssetLibrary.getBundle().GetAsset(path);

        if (asset2 != null)
        {
            return;
        }
        AssetLibrary.getBundle().AddAsset(asset);
    }
Example #18
0
        private void InitializeAssetLibraryCache()
        {
            AssetLibrary = new AssetLibrary();
            AssetLibrary.Initialize();

            Renderer.UserInterfaceAtlasses = TextureAtlasFactory.CreateAtlassesFromCfsBitmaps(Renderer.RenderingDevice, AssetLibrary.UserInterfaceBitmaps, "ui");
            Renderer.FloorAtlasses         = TextureAtlasFactory.CreateAtlassesFromCfsBitmaps(Renderer.RenderingDevice, AssetLibrary.FloorBitmaps, "floors");

            // TODO: Code below works, but get the tiles to render first.
            // Renderer.ObjectAtlasses = TextureAtlasFactory.CreateAtlassesFromCfsBitmaps(Renderer.RenderingDevice, AssetLibrary.ObjectBitmaps, "objects");
        }
Example #19
0
    void Start()
    {
        assetLibrary = new AssetLibrary();
        loadTreeStore();
        this.testText = "Hello World";

        loadGameData();
        loadPlayerGameCharacter();

        DontDestroyOnLoad(this);
    }
Example #20
0
        public async Task FetchAssets()
        {
            AssetLibrary assetLibrary             = client.AssetLibrary();
            ContentstackCollection <Asset> assets = await assetLibrary.FetchAll();

            Assert.True(assets.Count() > 0);
            foreach (Asset asset in assets)
            {
                Assert.True(asset.FileName.Length > 0);
            }
        }
Example #21
0
    public static Asset Load(string path, AssetType type, LoadType loadType = LoadType.Type_Resources)
    {
        Asset asset = AssetLibrary.getBundle().GetAsset(path);

        if (asset == null)
        {
            asset = new Asset(path, loadType, type);
            AssetLibrary.getBundle().AddAsset(asset);
            return(asset);
        }
        return(asset);
    }
Example #22
0
 /// <summary>
 /// 开始显示gameobject对象
 /// </summary>
 public void Visible()
 {
     if (this.destroyed || this.willRemoved)          //销毁或待移除,没法可视
     {
         return;
     }
     if (!this.visible)
     {
         if (this.ins == null)
         {
             if (this.prePath != string.Empty)                  //需要预先加载
             {
                 if (GameObjectUnit.thridPardResourManager != null && this.scene.loadFromAssetBund)
                 {
                     if (this.pre != null)
                     {
                         this.Initialize();
                     }
                     else
                     {
                         GameObjectUnit.thridPardResourManager(this.prePath, new AssetCallBack(this.OnThridPartAssetLoaded));
                     }
                 }
                 else
                 {
                     Asset asset = AssetLibrary.Load(this.prePath, AssetType.Prefab, LoadType.Type_Resources);
                     if (!asset.loaded)
                     {
                         this.pre = null;
                     }
                     else
                     {
                         this.pre = asset.gameObject;
                     }
                     if (this.pre != null)
                     {
                         this.Initialize();
                     }
                 }
             }
         }
         else
         {
             this.ins.SetActive(true);
         }
         if (!this.isStatic && this.ins != null)             //如果不是静态,激活动态unit
         {
             this.ActiveDynaUnit();
         }
     }
     this.visible = true;
 }
Example #23
0
        public async Task FetchAssetsIncludeRelativeURL()
        {
            AssetLibrary assetLibrary = client.AssetLibrary();

            assetLibrary.IncludeRelativeUrls();
            ContentstackCollection <Asset> assets = await assetLibrary.FetchAll();

            Assert.True(assets.Count() > 0);
            foreach (Asset asset in assets)
            {
                Assert.DoesNotContain(asset.Url, "http");
                Assert.True(asset.FileName.Length > 0);
            }
        }
Example #24
0
    /// <summary>
    /// 根据水体数据创建水体相关使用材质,这里似乎只有光照贴图材质??? 跟水体要毛关系啊??????
    /// </summary>
    /// <param name="waterData"></param>
    public void BuildMaterial(WaterData waterData = null)
    {
        if (LightmapSettings.lightmaps.Length > 0 || GameScene.isPlaying)          //有光照贴图
        {
            if (!this.terrainConfig.enablePointLight)
            {
                this.matrial = new Material(this.terrainMobileShader);
            }
            else
            {
                this.matrial = new Material(this.terrainMobileWithPointLightShader);
            }
        }
        else                                                                      //否则启用实时光照???
        {
            this.matrial = new Material(this.realLightShader);
        }
        Texture2D texture;

        if (GameScene.isPlaying)
        {
            texture = AssetLibrary.Load(this.splatsMapPath, AssetType.Texture2D, LoadType.Type_Auto).texture2D;
        }
        else
        {
            texture = this.terrainData.splatsmapTex;
        }
        this.matrial.SetTexture("_Control", texture);
        for (int i = 0; i < this.terrainData.spaltsmapLayers; i++)           //如果有splatmap,则添加
        {
            Splat splat = this.terrainData.splats[i];
            if (splat != null)
            {
                this.matrial.SetTexture("_Splat" + i, splat.texture);
                this.matrial.SetTextureScale("_Splat" + i, new Vector2(splat.tilingOffset.x, splat.tilingOffset.y));
                this.matrial.SetTextureOffset("_Splat" + i, Vector2.zero);
            }
            else
            {
                splat = this.terrainData.splats[0];
                this.matrial.SetTexture("_Splat" + i, this.terrainConfig.baseSplat.texture);
                this.matrial.SetTextureScale("_Splat" + i, new Vector2(splat.tilingOffset.x, splat.tilingOffset.y));
                this.matrial.SetTextureOffset("_Splat" + i, Vector2.zero);
            }
        }
        base.renderer.material = this.matrial;                               //给渲染器赋予材质
    }
Example #25
0
 public static List <string> FindDepends(string key)
 {
     if (AssetLibrary.dependsMap == null)
     {
         AssetLibrary.dependsMap = new Dictionary <string, List <string> >();
         AssetLibrary.AddDepends(AssetLibrary.downloadPath + "/Scenes/");
         AssetLibrary.AddDepends(AssetLibrary.streamAssetsPath + "/Scenes/");
     }
     foreach (KeyValuePair <string, List <string> > current in AssetLibrary.dependsMap)
     {
         if (key.Contains(current.Key))
         {
             return(current.Value);
         }
     }
     return(null);
 }
Example #26
0
        public async Task FetchAssetSkipLimit()
        {
            AssetLibrary assetLibrary             = client.AssetLibrary().SetLocale("en-us").Skip(2).Limit(5);
            ContentstackCollection <Asset> assets = await assetLibrary.FetchAll();

            if (assets == null)
            {
                Assert.False(true, "Query.Exec is not match with expected result.");
            }
            else if (assets != null)
            {
                Assert.Equal(3, assets.Items.Count());
            }
            else
            {
                Assert.False(true, "Result doesn't mathced the count.");
            }
        }
Example #27
0
        public async Task FetchAssetCountAsync()
        {
            AssetLibrary assetLibrary = client.AssetLibrary().SetLocale("en-us");
            JObject      jObject      = await assetLibrary.Count();

            if (jObject == null)
            {
                Assert.False(true, "Query.Exec is not match with expected result.");
            }
            else if (jObject != null)
            {
                Assert.Equal(5, jObject.GetValue("assets"));
                //Assert.True(true, "BuiltObject.Fetch is pass successfully.");
            }
            else
            {
                Assert.False(true, "Result doesn't mathced the count.");
            }
        }
Example #28
0
    public override void Load()
    {
        List <string> list = AssetLibrary.FindDepends(this.asset.assetPath);

        for (int i = 0; i < list.Count; i++)
        {
            Asset asset = AssetLibrary.Load(list[i], AssetType.AssetBundle, LoadType.Type_WWW);
            this.dependAssets.Add(asset);
            if (!asset.loaded)
            {
                asset.loadedListener = new Asset.LoadedListener(this.dependLoaded);
            }
            else
            {
                this.dependsLoadedCount++;
            }
        }
        this.CheckLoadedComplate();
        this.mainDependAsset = this.dependAssets[0];
    }
Example #29
0
        protected override void ValidateEntity(AssetAudit entity)
        {
            ModelState.Clear();

            if (entity.Party == null || entity.Party.ID <= 0)
            {
                ModelState.AddModelError("Party", "The Party Name field is required.");
            }
            if (entity.Location == null || entity.Location.ID <= 0)
            {
                ModelState.AddModelError("Location", "The Location Name field is required.");
            }
            if (entity.Asset != null && entity.Asset.ID > 0)
            {
                Asset asset = new AssetLibrary(ConfigurationHelper.GetsmARTDBContextConnectionString()).GetByID(entity.Asset.ID.ToString());
                if (!asset.Asset_Type.Equals("Bin", StringComparison.InvariantCultureIgnoreCase))
                {
                    ModelState.AddModelError("AssetType", "Tracking is enabled only for Asset Type = Bin");
                }
            }
        }
Example #30
0
        public async Task FetchAssetsOrderByAscending()
        {
            AssetLibrary assetLibrary = client.AssetLibrary();

            assetLibrary.SortWithKeyAndOrderBy("created_at", Internals.OrderBy.OrderByAscending);
            ContentstackCollection <Asset> assets = await assetLibrary.FetchAll();

            Assert.True(assets.Count() > 0);
            DateTime dateTime = new DateTime();

            foreach (Asset asset in assets)
            {
                if (dateTime != null)
                {
                    if (dateTime.CompareTo(asset.GetCreateAt()) != -1 && dateTime.CompareTo(asset.GetCreateAt()) != 0)
                    {
                        Assert.False(true);
                    }
                }
                dateTime = asset.GetCreateAt();
                Assert.True(asset.FileName.Length > 0);
            }
        }