-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2a7baca
Showing
53 changed files
with
8,682 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
[Ll]ibrary/ | ||
[Tt]emp/ | ||
[Oo]bj/ | ||
[Bb]uild/ | ||
/[Bb]uilds/ | ||
/Assets/AssetStoreTools* | ||
|
||
# Autogenerated VS/MD solution and project files | ||
ExportedObj/ | ||
*.csproj | ||
*.unityproj | ||
*.sln | ||
*.suo | ||
*.tmp | ||
*.user | ||
*.userprefs | ||
*.pidb | ||
*.booproj | ||
*.svd | ||
|
||
|
||
# Unity3D generated meta files | ||
*.pidb.meta | ||
|
||
# Unity3D Generated File On Crash Reports | ||
sysinfo.txt | ||
|
||
# Mac | ||
*.DS_Store | ||
|
||
# Builds | ||
*.apk | ||
|
||
|
||
# Packages | ||
*.unitypackage | ||
Samples~/Demo.meta |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using UnityEngine.U2D; | ||
using UnityEngine.UI; | ||
|
||
namespace Coffee.UIExtensions | ||
{ | ||
/// <summary> | ||
/// Atlas image. | ||
/// </summary> | ||
public class AtlasImage : Image | ||
{ | ||
[SerializeField] private string m_SpriteName; | ||
[SerializeField] private SpriteAtlas m_SpriteAtlas; | ||
private string _lastSpriteName = ""; | ||
|
||
|
||
/// <summary>Sprite Name. If there is no other sprite with the same name in the atlas, AtlasImage will display the default sprite.</summary> | ||
public string spriteName | ||
{ | ||
get { return m_SpriteName; } | ||
set | ||
{ | ||
if (m_SpriteName != value) | ||
{ | ||
m_SpriteName = value; | ||
SetAllDirty(); | ||
} | ||
} | ||
} | ||
|
||
/// <summary>SpriteAtlas. Get and set atlas assets created by AtlasMaker.</summary> | ||
public SpriteAtlas spriteAtlas | ||
{ | ||
get { return m_SpriteAtlas; } | ||
set | ||
{ | ||
if (m_SpriteAtlas != value) | ||
{ | ||
m_SpriteAtlas = value; | ||
SetAllDirty(); | ||
} | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Sets the material dirty. | ||
/// </summary> | ||
public override void SetMaterialDirty() | ||
{ | ||
// Changing sprites from Animation. | ||
// If the "sprite" is changed by an animation or script, it will be reflected in the sprite name. | ||
if (_lastSpriteName == spriteName && sprite) | ||
{ | ||
m_SpriteName = sprite.name.Replace("(Clone)", ""); | ||
} | ||
|
||
if (_lastSpriteName != spriteName) | ||
{ | ||
_lastSpriteName = spriteName; | ||
sprite = spriteAtlas ? spriteAtlas.GetSprite(spriteName) : null; | ||
} | ||
|
||
base.SetMaterialDirty(); | ||
} | ||
|
||
|
||
protected AtlasImage() | ||
: base() | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Raises the populate mesh event. | ||
/// </summary> | ||
/// <param name="toFill">To fill.</param> | ||
protected override void OnPopulateMesh(VertexHelper toFill) | ||
{ | ||
if (!overrideSprite) | ||
{ | ||
toFill.Clear(); | ||
return; | ||
} | ||
base.OnPopulateMesh(toFill); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Changelog | ||
|
||
## [v0.1.0](https://github.com/mob-sakai/AtlasImage/tree/v0.1.0) (2018-04-30) | ||
|
||
[Full Changelog](https://github.com/mob-sakai/AtlasImage/compare/6159735114a782ced87eb55c93edad44cad146c4...v0.1.0) | ||
|
||
**Implemented enhancements:** | ||
|
||
- Feature: You can edit the border in the preview window [\#3](https://github.com/mob-sakai/AtlasImage/issues/3) | ||
- Feature: In the inspector, sprite selection window shows only sprites in SpriteAtlas [\#2](https://github.com/mob-sakai/AtlasImage/issues/2) | ||
- Feature: Sprite for renderring can be changed using a SpriteAtlas and a sprite name [\#1](https://github.com/mob-sakai/AtlasImage/issues/1) | ||
|
||
|
||
|
||
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "Coffee.AtlasImage", | ||
"references": [], | ||
"optionalUnityReferences": [], | ||
"includePlatforms": [], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.