本文整理汇总了C#中OTContainer类的典型用法代码示例。如果您正苦于以下问题:C# OTContainer类的具体用法?C# OTContainer怎么用?C# OTContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OTContainer类属于命名空间,在下文中一共展示了OTContainer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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();
}
示例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;
}
示例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;
}
示例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);
}
示例6: RegisterContainerLookup
public static void RegisterContainerLookup(OTContainer container, string oldName)
{
if (isValid)
instance._RegisterContainerLookup(container, oldName);
}
示例7: RegisterContainer
public static void RegisterContainer(OTContainer container)
{
if (isValid)
instance._RegisterContainer(container);
}
示例8: _DestroyContainer
void _DestroyContainer(OTContainer container)
{
_RemoveContainer(container);
if (container.gameObject != null)
Destroy(container.gameObject);
}
示例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);
}
}
示例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);
}
}
示例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;
}
}
}
示例12: _ResetContainer
void _ResetContainer(OTContainer container)
{
container.Reset();
}
示例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;
}
示例14: DestroyContainer
/// <summary>
/// Destroys an Orthello container
/// </summary>
public static void DestroyContainer(OTContainer container)
{
if (isValid)
instance._DestroyContainer(container);
}
示例15: RemoveContainer
public static void RemoveContainer(OTContainer o)
{
if (isValid)
instance._RemoveContainer(o);
}