本文整理汇总了C#中OTContainer类的典型用法代码示例。如果您正苦于以下问题:C# OTContainer类的具体用法?C# OTContainer怎么用?C# OTContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OTContainer类属于命名空间,在下文中一共展示了OTContainer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreateFrameset
private OTAnimationFrameset CreateFrameset(string name, OTContainer container, int startFrameIndex, int endFrameIndex)
{
MZDebug.Log( "Add frameset: " + name );
OTAnimationFrameset frameset = new OTAnimationFrameset();
frameset.name = name;
frameset.container = container;
frameset.startFrame = startFrameIndex;
frameset.endFrame = endFrameIndex;
return frameset;
}
开发者ID:adahera222,项目名称:MSSTGameProj,代码行数:12,代码来源:MZOTAnimationsManager.cs
示例2: AddAnimations
private void AddAnimations(OTContainer container)
{
if( _spritesheetContainer == null )
_spritesheetContainer = new Dictionary<string, OTContainer>();
spritesheetContainer.Add( container.name, container );
List<OTAnimationFrameset> framesetsList = new List<OTAnimationFrameset>();
List<string> frameNamesList = new List<string>();
SetFramesets( ref framesetsList, ref frameNamesList, container );
if( cloneAniamtion == null )
{
cloneAniamtion = MZResources.InstantiateOrthelloSprite( "Animation" );
( (OTAnimation)cloneAniamtion.GetComponent( typeof( OTAnimation ) ) ).name = "AnimationsCollection";
}
// suck code here, when add new spritesheet, it will re-new again
OTAnimation animation = (OTAnimation)cloneAniamtion.GetComponent( typeof( OTAnimation ) );
List<OTAnimationFrameset> newFramesetsList = new List<OTAnimationFrameset>( animation.framesets );
newFramesetsList.AddRange( framesetsList );
animation.framesets = newFramesetsList.ToArray();
}
开发者ID:adahera222,项目名称:MSSTGameProj,代码行数:24,代码来源:MZOTAnimationsManager.cs
示例3: Clean
protected override void Clean()
{
if (!OT.isValid) return;
base.Clean();
if (_spriteContainer_ != spriteContainer ||
_frameIndex_ != frameIndex ||
_image_ != image ||
_tintColor_ != tintColor ||
_alpha_ != alpha ||
_materialReference_ != _materialReference ||
isCopy)
{
if (spriteContainer != null && spriteContainer.isReady)
{
if (frameIndex < 0) _frameIndex = 0;
if (frameIndex > spriteContainer.frameCount - 1) _frameIndex = spriteContainer.frameCount - 1;
if (spriteContainer is OTSpriteAtlas)
{
OTContainer.Frame fr = CurrentFrame();
if ((spriteContainer as OTSpriteAtlas).offsetSizing)
{
if (Vector2.Equals(oSize, Vector2.zero))
{
oSize = fr.size * OT.view.sizeFactor;
Vector2 nOffset = fr.offset * OT.view.sizeFactor;
if (_baseOffset.x != nOffset.x || _baseOffset.y != nOffset.y)
{
offset = nOffset;
position = _position;
imageSize = fr.imageSize * OT.view.sizeFactor;
}
}
if (_frameIndex_ != frameIndex || _spriteContainer_ != spriteContainer)
{
Vector2 sc = new Vector2((size.x / oSize.x) * fr.size.x * OT.view.sizeFactor, (size.y / oSize.y) * fr.size.y * OT.view.sizeFactor);
Vector3 sc3 = new Vector3(sc.x, sc.y, 1);
_size = sc;
if (!Vector3.Equals(transform.localScale, sc3))
transform.localScale = sc3;
oSize = fr.size * OT.view.sizeFactor;
imageSize = fr.imageSize * OT.view.sizeFactor;
Vector2 nOffset = fr.offset * OT.view.sizeFactor;
if (_baseOffset.x != nOffset.x || _baseOffset.y != nOffset.y)
{
offset = nOffset;
position = _position;
}
}
}
else
{
Vector3[] verts = fr.vertices.Clone() as Vector3[];
verts[0] -= new Vector3(pivotPoint.x, pivotPoint.y, 0);
verts[1] -= new Vector3(pivotPoint.x, pivotPoint.y, 0);
verts[2] -= new Vector3(pivotPoint.x, pivotPoint.y, 0);
verts[3] -= new Vector3(pivotPoint.x, pivotPoint.y, 0);
mesh.vertices = verts;
_size = fr.size;
Vector3 sc3 = new Vector3(_size.x, _size.y, 1);
if (!Vector3.Equals(transform.localScale, sc3))
transform.localScale = sc3;
}
}
}
Material mat = LookupMaterial();
if (mat == null)
{
mat = InitMaterial();
}
else
{
renderer.material = mat;
HandleUV(mat);
}
OT.MatInc(mat);
_spriteContainer_ = spriteContainer;
_materialReference_ = materialReference;
_frameIndex_ = frameIndex;
_image_ = image;
_tintColor_ = tintColor;
_alpha_ = alpha;
}
isDirty = false;
if (spriteContainer != null && !spriteContainer.isReady)
isDirty = true;
}
开发者ID:artalgame,项目名称:mushrooms,代码行数:93,代码来源:OTSprite.cs
示例4: ContainerSprites
public static List<OTSprite> ContainerSprites(OTContainer container)
{
if (isValid)
{
List<OTSprite> res = new List<OTSprite>();
for (int o=0; o<instance.objects.Count; o++)
{
if (instance.objects[o] is OTSprite && (instance.objects[o] as OTSprite).spriteContainer == container)
res.Add(instance.objects[o] as OTSprite);
}
return res;
}
return null;
}
开发者ID:KonstantinDavidov,项目名称:hotfix,代码行数:14,代码来源:OT.cs
示例5: FrameOffsetSize
void FrameOffsetSize(OTContainer.Frame fr)
{
float _sx = (size.x / oSize.x);
float _sy = (size.y / oSize.y);
Vector2 sc = new Vector2(_sx * fr.size.x * OT.view.sizeFactor, _sy * fr.size.y * OT.view.sizeFactor);
Vector3 sc3 = new Vector3(sc.x, sc.y, 1);
_size = sc;
if (!Vector3.Equals(otTransform.localScale, sc3))
otTransform.localScale = sc3;
oSize = fr.size * OT.view.sizeFactor;
FrameOffset(fr);
}
开发者ID:Tavrox,项目名称:Lavapools,代码行数:12,代码来源:OTSprite.cs
示例6: RegisterContainerLookup
public static void RegisterContainerLookup(OTContainer container, string oldName)
{
if (isValid)
instance._RegisterContainerLookup(container, oldName);
}
开发者ID:KonstantinDavidov,项目名称:hotfix,代码行数:5,代码来源:OT.cs
示例7: RegisterContainer
public static void RegisterContainer(OTContainer container)
{
if (isValid)
instance._RegisterContainer(container);
}
开发者ID:KonstantinDavidov,项目名称:hotfix,代码行数:5,代码来源:OT.cs
示例8: _DestroyContainer
void _DestroyContainer(OTContainer container)
{
_RemoveContainer(container);
if (container.gameObject != null)
Destroy(container.gameObject);
}
开发者ID:KonstantinDavidov,项目名称:hotfix,代码行数:6,代码来源:OT.cs
示例9: _RemoveContainer
void _RemoveContainer(OTContainer container)
{
if (containerList.Contains(container))
{
string lname = container.name.ToLower();
if (containers.ContainsKey(lname))
containers.Remove(lname);
if (containerList.Contains(container))
containerList.Remove(container);
}
}
开发者ID:KonstantinDavidov,项目名称:hotfix,代码行数:11,代码来源:OT.cs
示例10: _RegisterContainerLookup
void _RegisterContainerLookup(OTContainer container, string oldName)
{
if (containerList.Contains(container))
{
if (containers.ContainsKey(oldName.ToLower()) && containers[oldName.ToLower()] == container)
containers.Remove(oldName.ToLower());
if (containers.ContainsKey(container.name.ToLower()))
containers.Remove(container.name.ToLower());
containers.Add(container.name.ToLower(), container);
}
}
开发者ID:KonstantinDavidov,项目名称:hotfix,代码行数:11,代码来源:OT.cs
示例11: _RegisterContainer
void _RegisterContainer(OTContainer container)
{
if (!containerList.Contains(container))
containerList.Add(container);
if (!containers.ContainsKey(container.name.ToLower()))
containers.Add(container.name.ToLower(), container);
else
{
if (containers[container.name.ToLower()] != container)
Debug.LogError("More than one SpriteContainer with name '" + container.name + "'");
}
foreach (Transform child in transform)
{
if (child.name.ToLower() == "containers")
{
container.transform.parent = child.transform;
break;
}
}
}
开发者ID:KonstantinDavidov,项目名称:hotfix,代码行数:23,代码来源:OT.cs
示例12: _ResetContainer
void _ResetContainer(OTContainer container)
{
container.Reset();
}
开发者ID:KonstantinDavidov,项目名称:hotfix,代码行数:4,代码来源:OT.cs
示例13: FrameOffset
void FrameOffset(OTContainer.Frame fr)
{
float _sx = (size.x / oSize.x);
float _sy = (size.y / oSize.y);
imageSize = new Vector2(_sx * fr.imageSize.x * OT.view.sizeFactor, _sy * fr.imageSize.y * OT.view.sizeFactor);
Vector2 nOffset = new Vector2(_sx * fr.offset.x * OT.view.sizeFactor, _sy * fr.offset.y * OT.view.sizeFactor);
if (flipHorizontal)
nOffset.x = (((fr.imageSize.x * OT.view.sizeFactor) - oSize.x) * _sx) - nOffset.x;
if (flipVertical)
nOffset.y = (((fr.imageSize.y * OT.view.sizeFactor) - oSize.y) * _sy) - nOffset.y;
offset = nOffset;
position = _position;
}
开发者ID:Tavrox,项目名称:Lavapools,代码行数:15,代码来源:OTSprite.cs
示例14: DestroyContainer
/// <summary>
/// Destroys an Orthello container
/// </summary>
public static void DestroyContainer(OTContainer container)
{
if (isValid)
instance._DestroyContainer(container);
}
开发者ID:KonstantinDavidov,项目名称:hotfix,代码行数:8,代码来源:OT.cs
示例15: RemoveContainer
public static void RemoveContainer(OTContainer o)
{
if (isValid)
instance._RemoveContainer(o);
}
开发者ID:KonstantinDavidov,项目名称:hotfix,代码行数:5,代码来源:OT.cs
示例16: WalkingFrameset
// Create an walking man animation frameset with 15 images
// INFO : Because our walking man sprite sheet contains 8 direction
// animations of 15 frames. We will put these into seperate animation
// framesets, so they can be played quickly when needed.
OTAnimationFrameset WalkingFrameset(string name, int row, OTContainer sheet)
{
// Create a new frameset
OTAnimationFrameset frameset = new OTAnimationFrameset();
// Give this frameset a name for later reference
frameset.name = name;
// Link our provided sprite sheet
frameset.container = sheet;
// Set the correct start frame
frameset.startFrame = (row - 1) * 15;
// Set the correct end frame
frameset.endFrame = ((row - 1) * 15) + 14;
// Set this frameset's animation duration that will only
// be used when the frameset is played as a single animation
frameset.singleDuration = 0.95f;
// Return this new frameset
return frameset;
}
开发者ID:phildini,项目名称:UnityLodeRunner,代码行数:22,代码来源:CExample5.cs
示例17: SetFramesets
private void SetFramesets(ref List<OTAnimationFrameset> framesetsList, ref List<string> frameNamesList, OTContainer container)
{
if( framesetsList == null )
framesetsList = new List<OTAnimationFrameset>();
if( frameNamesList == null )
frameNamesList = new List<string>();
int startFrameIndex = 0;
int endFrameIndex = -1;
int index = 0;
string preClearFrameName = null;
OTAtlasData[] datas = container.GetComponent<OTSpriteAtlasCocos2D>().atlasData;
foreach( OTAtlasData data in datas )
{
string frameName = data.name;
string currentClearFrameName = GetFrameNameWithoutIndex( frameName );
if( preClearFrameName == null )
{
preClearFrameName = currentClearFrameName;
}
if( currentClearFrameName != preClearFrameName || index == datas.Length - 1 )
{
endFrameIndex = ( index == datas.Length - 1 )? index : index - 1;
OTAnimationFrameset frameset = CreateFrameset( preClearFrameName, container, startFrameIndex, endFrameIndex );
framesetsList.Add( frameset );
frameNamesList.Add( preClearFrameName );
startFrameIndex = index;
preClearFrameName = currentClearFrameName;
}
index++;
}
}
开发者ID:adahera222,项目名称:MSSTGameProj,代码行数:41,代码来源:MZOTAnimationsManager.cs
示例18: Clean
protected override void Clean()
{
if (!OT.isValid || mesh == null) return;
base.Clean();
if (Application.isPlaying)
{
if (OT.sizeFactor!=1)
{
for (int i=0; i<sizeImages.Length; i++)
{
if (sizeImages[i].sizeFactor == OT.sizeFactor)
{
if (_defaultImage==null)
_defaultImage = texture;
_image = sizeImages[i].texture;
}
}
}
else
{
if (_defaultImage!=null)
_image = _defaultImage;
}
}
if (_spriteContainer_ != spriteContainer ||
_frameIndex_ != frameIndex ||
_frameName_ != frameName ||
_image_ != image ||
_tintColor_ != tintColor ||
_alpha_ != alpha ||
_materialReference_ != _materialReference ||
isCopy)
{
if (spriteContainer != null && spriteContainer.isReady)
{
if (_frameName_ != frameName)
_frameIndex = spriteContainer.GetFrameIndex(frameName);
if (frameIndex < 0) _frameIndex = 0;
if (frameIndex > spriteContainer.frameCount - 1) _frameIndex = spriteContainer.frameCount - 1;
// set frame name
OTContainer.Frame fr = CurrentFrame();
if (fr.name!="" && (frameName == "" || fr.name.IndexOf(frameName)!=0))
_frameName = fr.name;
if (spriteContainer is OTSpriteAtlas)
{
if (adjustFrameSize)
{
if ((spriteContainer as OTSpriteAtlas).offsetSizing)
{
if (Vector2.Equals(oSize, Vector2.zero))
{
oSize = fr.size * OT.view.sizeFactor;
Vector2 nOffset = fr.offset * OT.view.sizeFactor;
if (flipHorizontal)
nOffset.x = (fr.imageSize.x * OT.view.sizeFactor) - oSize.x - nOffset.x;
if (flipVertical)
nOffset.y = (fr.imageSize.y * OT.view.sizeFactor) - oSize.y - nOffset.y;
if (_baseOffset.x != nOffset.x || _baseOffset.y != nOffset.y)
{
offset = nOffset;
position = _position;
imageSize = fr.imageSize * OT.view.sizeFactor;
}
}
if (_frameIndex_ != frameIndex || _spriteContainer_ != spriteContainer)
{
float _sx = (size.x / oSize.x);
float _sy = (size.y / oSize.y);
Vector2 sc = new Vector2(_sx * fr.size.x * OT.view.sizeFactor, _sy * fr.size.y * OT.view.sizeFactor);
Vector3 sc3 = new Vector3(sc.x, sc.y, 1);
_size = sc;
if (!Vector3.Equals(otTransform.localScale, sc3))
otTransform.localScale = sc3;
oSize = fr.size * OT.view.sizeFactor;
imageSize = new Vector2(_sx * fr.imageSize.x * OT.view.sizeFactor, _sy * fr.imageSize.y * OT.view.sizeFactor);
Vector2 nOffset = new Vector2(_sx * fr.offset.x * OT.view.sizeFactor, _sy * fr.offset.y * OT.view.sizeFactor);
if (flipHorizontal)
nOffset.x = (fr.imageSize.x * OT.view.sizeFactor) - oSize.x - nOffset.x;
if (flipVertical)
nOffset.y = (fr.imageSize.y * OT.view.sizeFactor) - oSize.y - nOffset.y;
offset = nOffset;
position = _position;
}
}
else
{
Vector3[] verts = fr.vertices.Clone() as Vector3[];
//.........这里部分代码省略.........
开发者ID:kdiggety,项目名称:KayDiggsProjects,代码行数:101,代码来源:OTSprite.cs
示例19: LoadTile
private void LoadTile(OgmoTile tile, OTContainer container, float height)
{
string tileName = string.Format ("frame{0}", tile.id);
string tilePath = (zoneFolder ?? "") + tileName;
var go = GetPrefab (tilePath);
if (go != null) {
go = (GameObject)GameObject.Instantiate (go);
go.transform.parent = lvl.transform;
OTSprite ot = go.GetComponent<OTSprite> ();
go.transform.localPosition = new Vector3 (tile.x, height, 15 - tile.y);
if (ot != null) {
ot.position = new Vector2 (go.transform.localPosition.x, go.transform.localPosition.z);
ot.depth = (int)height;
int id = ot.frameIndex;
ot.spriteContainer = container;
ot.frameIndex = id;
ot.otTransform = ot.transform;
ot.transform.localScale = Vector3.one;
}
}
}
开发者ID:sideshowdave7,项目名称:darknessgamejam,代码行数:22,代码来源:LevelLoader.cs
示例20: Awake
//-----------------------------------------------------------------------------
// class methods
//-----------------------------------------------------------------------------
// Use this for initialization
/// <exclude />
protected override void Awake()
{
_spriteContainer_ = spriteContainer;
_frameIndex_ = frameIndex;
_image_ = image;
_materialReference_ = materialReference;
_transparent_ = transparent;
_flipHorizontal_ = flipHorizontal;
_flipVertical_ = flipVertical;
_tintColor_ = _tintColor;
_alpha_ = _alpha;
isDirty = true;
base.Awake();
}
开发者ID:artalgame,项目名称:mushrooms,代码行数:19,代码来源:OTSprite.cs
注:本文中的OTContainer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论