-
-
Save monry/71c5e99fb62c7f7da680 to your computer and use it in GitHub Desktop.
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
public class MNR_SpriteStudioUtil { | |
public void SetColor(Script_SpriteStudio_PartsRoot partsRoot, string partsName, Color color, Library_SpriteStudio.KindColorOperation colorBlendMode) { | |
foreach (Library_SpriteStudio.AnimationInformationPlay animationInformationPlay in partsRoot.ListInformationPlay) { | |
foreach (Script_SpriteStudio_Triangle2 parts in partsRoot.gameObject.GetComponentsInChildren<Library_SpriteStudio.SpriteBase>()) { | |
if (string.IsNullOrEmpty(partsName) || partsName == parts.name) { | |
if (0 == parts.SpriteStudioData.AnimationDataColorBlend.Length) { | |
parts.SpriteStudioData.AnimationDataColorBlend = new Library_SpriteStudio.KeyFrame.ValueColor[animationInformationPlay.FrameEnd + 1]; | |
for (int i = animationInformationPlay.FrameStart; i <= animationInformationPlay.FrameEnd; i++) { | |
parts.SpriteStudioData.AnimationDataColorBlend[i] = new Library_SpriteStudio.KeyFrame.ValueColor(); | |
} | |
} | |
for (int i = animationInformationPlay.FrameStart; i <= animationInformationPlay.FrameEnd; i++) { | |
parts.SpriteStudioData.AnimationDataColorBlend[i].Operation = colorBlendMode; | |
parts.SpriteStudioData.AnimationDataColorBlend[i].Bound = Library_SpriteStudio.KindColorBound.OVERALL; | |
for (int j = 0; j < (int)Library_SpriteStudio.VertexNo.TERMINATOR4; j++) { | |
parts.SpriteStudioData.AnimationDataColorBlend[i].VertexColor[j] = color; | |
parts.SpriteStudioData.AnimationDataColorBlend[i].RatePixelAlpha[j] = color.a; | |
} | |
} | |
} | |
} | |
} | |
} | |
public void SetAlpha(Script_SpriteStudio_PartsRoot partsRoot, string partsName, float alpha, Library_SpriteStudio.KindColorOperation colorBlendMode) { | |
foreach (Library_SpriteStudio.AnimationInformationPlay animationInformationPlay in partsRoot.ListInformationPlay) { | |
foreach (Script_SpriteStudio_Triangle2 parts in partsRoot.gameObject.GetComponentsInChildren<Library_SpriteStudio.SpriteBase>()) { | |
if (string.IsNullOrEmpty(partsName) || partsName == parts.name) { | |
if (0 == parts.SpriteStudioData.AnimationDataColorBlend.Length) { | |
parts.SpriteStudioData.AnimationDataColorBlend = new Library_SpriteStudio.KeyFrame.ValueColor[animationInformationPlay.FrameEnd + 1]; | |
for (int i = animationInformationPlay.FrameStart; i <= animationInformationPlay.FrameEnd; i++) { | |
parts.SpriteStudioData.AnimationDataColorBlend[i] = new Library_SpriteStudio.KeyFrame.ValueColor(); | |
} | |
} | |
for (int i = animationInformationPlay.FrameStart; i <= animationInformationPlay.FrameEnd; i++) { | |
parts.SpriteStudioData.AnimationDataColorBlend[i].Operation = colorBlendMode; | |
parts.SpriteStudioData.AnimationDataColorBlend[i].Bound = Library_SpriteStudio.KindColorBound.OVERALL; | |
for (int j = 0; j < (int)Library_SpriteStudio.VertexNo.TERMINATOR4; j++) { | |
parts.SpriteStudioData.AnimationDataColorBlend[i].RatePixelAlpha[j] = alpha; | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment