Skip to content

greatclock/rendertexture_icons_demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IconAtlasDemo


About This Repository

It is a demo unity project for RenderTextureIcons solution which is dedicated to optimizing rendering of item blocks for item such as bag items, hero icons and equip icons.

It contains the following fake logics :

  • Item block drawing logic.

  • HeroData, ItemData and EquipData and their data generator.

  • Texture loader.

  • Common assets holder. E.g. item backgrounds, frames, tags, fonts and colors.

  • Item block list display.

  • Text drawing ('GreatArtText' in Unity Asset Store is required).

Note : All the codes and assets in this demo project are what you should do to use RenderTextureIcons in your project to match your game logic.

How to Run It

  1. Clone this repository.

  2. Clone RenderTextureIcons and move it into 'Package' folder of this demo repo.

  3. Copy some icon textures into 'Assets/Resources/EquipIcons', 'Assets/Resources/HeroIcons' and 'Assets/Resources/ItemIcons' 3 folders. Modify the import settings of these textures if necessory. There should be at least ONE texture in each folder.

  4. Open this project in Unity and run "Demo > Collect Icons" in tool bar, Thus 'Assets/Scripts/TestAtlasIconRes.cs' will be updated with texture paths of the icons you just copied.

  5. Open 'Scenes/SampleScene' in Project window and run it.

Work with Text Rendering

  1. Search 'GreatArtText' asset in Unity Asset Store and add it to this unity project.

  2. Enable UNABLE_RENDER_TEXT macro in either project settings or by inserting #define UNABLE_RENDER_TEXT into the first line of 'Assets/Scripts/IconDrawer.cs'.

  3. Open 'Scenes/SampleScene' in Project window and run it. You'll see the colored hero name of RectHero and the amount of the items.

Demo Scripts

IconDrawer.cs

Drawing logic that make all item block data visible.

It draws the followings into the atlas sector.

  • Sprite from atlas.

  • Texture2D.

  • Text that has rendered into Texture with fxs and colors.

  • Masked texture.

TestController.cs

  • It generates fake item datas.

  • It manages items in grid list.

  • It invokes items drawing methods.

FakeLoader.cs

A async texture loader that can cache loaded textures for a few seconds after its latest usage.

If a texture is cached, it can be retrieved via sync get method.

IconAssetHolder.cs

It holds or references the followings when attached to a GameObject :

  • Backgrounds for item block.

  • Frames for item block.

  • All kinds of tags.

  • Default icons when icon texture is loading.

  • Mask textures.

  • Text fonts and colors.

DataTypes.cs

Fake data typs for hero icon block, item icon block and equip icon block.

TestAtlasIconRes.cs

All texture icon paths in each individual inner classes.

This c# file should be generated by running "Demo > Collect Icons" in tool bar after you copy your icon textures into 'Assets/Resources/EquipIcons' , 'Assets/Resources/HeroIcons' and 'Assets/Resources/ItemIcons' folders.

About

A demo project for rendertexture_icons.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages