本文整理汇总了C#中UnityEngine.Texture类的典型用法代码示例。如果您正苦于以下问题:C# Texture类的具体用法?C# Texture怎么用?C# Texture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Texture类属于UnityEngine命名空间,在下文中一共展示了Texture类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Awake
private void Awake()
{
myRenderer = GetComponentInChildren<Renderer> ();
originalTexture = myRenderer.material.mainTexture;
SetStartPosition (startPosition);
InitMapObjectType();
}
示例2: OnEnable
void OnEnable()
{
touchManager = target as TouchManager;
var path = AssetDatabase.GetAssetPath( MonoScript.FromScriptableObject( this ) );
headerTexture = AssetDatabase.LoadAssetAtPath<Texture>( Path.GetDirectoryName( path ) + "/Images/TouchManagerHeader.png" );
}
示例3: AspectSelectionGrid
public static int AspectSelectionGrid(int selected, Texture[] textures, int approxSize, GUIStyle style, string emptyString, out bool doubleClick)
{
GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MinHeight(10f) };
GUILayout.BeginVertical("box", options);
int num = 0;
doubleClick = false;
if (textures.Length != 0)
{
float num2 = (EditorGUIUtility.currentViewWidth - 20f) / ((float) approxSize);
int num3 = (int) Mathf.Ceil(((float) textures.Length) / num2);
Rect aspectRect = GUILayoutUtility.GetAspectRect(num2 / ((float) num3));
Event current = Event.current;
if (((current.type == EventType.MouseDown) && (current.clickCount == 2)) && aspectRect.Contains(current.mousePosition))
{
doubleClick = true;
current.Use();
}
num = GUI.SelectionGrid(aspectRect, selected, textures, Mathf.RoundToInt(EditorGUIUtility.currentViewWidth - 20f) / approxSize, style);
}
else
{
GUILayout.Label(emptyString, new GUILayoutOption[0]);
}
GUILayout.EndVertical();
return num;
}
示例4: ComponentTypeDesc
public ComponentTypeDesc(string name, Type type, Texture icon, string tooltip)
{
Name = name;
Type = type;
Icon = icon;
Tooltip = tooltip;
}
示例5: CreateFromTexture
public static tk2dSpriteCollectionData CreateFromTexture(Texture texture, tk2dSpriteCollectionSize size, Rect region, Vector2 anchor)
{
string[] names = new string[] { "Unnamed" };
Rect[] regions = new Rect[] { region };
Vector2[] anchors = new Vector2[] { anchor };
return CreateFromTexture(texture, size, names, regions, anchors);
}
示例6: LoadResources
static public void LoadResources()
{
UnityPrimitiveCubeThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Cube.png");
UnityPrimitiveSphereThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Sphere.png");
UnityPrimitiveCylinderThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Cylinder.png");
UnityPrimitiveCapsuleThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Capsule.png");
UnityPrimitivePlaneThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Plane.png");
UnityPrimitiveQuadThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Quad.png");
UnityPrimitivePointlightThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Pointlight.png");
UnityPrimitiveArealightThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Arealight.png");
UnityPrimitiveSunlightThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Sunlight.png");
UnityPrimitiveSpotlightThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Spotlight.png");
UnityPrimitiveReflectionprobeThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Reflectionprobe.png");
UnityPrimitiveLightprobegroupThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Lightprobegroup.png");
UnityPrimitiveParticlesystemThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Particlesystem.png");
UnityPrimitiveAudioemitterThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Audioemitter.png");
UnityPrimitiveAudioreverbThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Audioreverb.png");
UnityPrimitiveCameraThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Camera.png");
UnityPrimitiveCameraviewportThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Cameraviewport.png");
UnityPrimitiveTreeThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Tree.png");
UnityPrimitiveLandscapeThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Landscape.png");
UnityPrimitiveSpriteThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Sprite.png");
UnityPrimitiveNullobjectThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Nullobject.png");
ButtonSize.x = UnityPrimitiveCubeThumb.width;
ButtonSize.y = UnityPrimitiveCubeThumb.height;
IconsSkin = AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlusSkinIcons.guiskin") as GUISkin;
if(window != null)
window.Repaint();
}
示例7: Reset
public override void Reset()
{
gameObject = null;
materialIndex = 0;
namedTexture = "_MainTex";
texture = null;
}
示例8: Reset
public override void Reset() {
base.Reset();
this.tempTexture = null;
}
示例9: DrawBackground
public static void DrawBackground(Rect position, Texture image, float scale = 0.15f)
{
float texWidth = image.width * scale;
GUI.BeginGroup (position);
// Top Left Region
GUI.DrawTextureWithTexCoords (new Rect (0, 0, texWidth, texWidth), image, new Rect (0, 1 - scale, scale, scale));
// Top Center Region
GUI.DrawTextureWithTexCoords (new Rect (texWidth, 0, position.width - texWidth * 2, texWidth), image, new Rect (1 - scale, 1 - scale, 0, scale));
// Top Right Region
GUI.DrawTextureWithTexCoords (new Rect (position.width - texWidth, 0, texWidth, texWidth), image, new Rect (1 - scale, 1 - scale, scale, scale));
// Middle Left Region
GUI.DrawTextureWithTexCoords (new Rect (0, texWidth, texWidth, position.height - texWidth * 2), image, new Rect (0, 1 - scale, scale, 0));
// Middle Center Region
GUI.DrawTextureWithTexCoords (new Rect (texWidth, texWidth, position.width - texWidth * 2, position.height - texWidth * 2), image, new Rect (0.5f, 0.5f, 0, 0));
// Middle Right Region
GUI.DrawTextureWithTexCoords (new Rect (position.width - texWidth, texWidth, texWidth, position.height - texWidth * 2), image, new Rect (1 - scale, 1 - scale, scale, 0));
// Bottom Left Region
GUI.DrawTextureWithTexCoords (new Rect (0, position.height - texWidth, texWidth, texWidth), image, new Rect (0, 0, scale, scale));
// Bottom Center Region
GUI.DrawTextureWithTexCoords (new Rect (texWidth, position.height - texWidth, position.width - texWidth * 2, texWidth), image, new Rect (1 - scale, 0, 0, scale));
// Bottom Right Region
GUI.DrawTextureWithTexCoords (new Rect (position.width - texWidth, position.height - texWidth, texWidth, texWidth), image, new Rect (1 - scale, 0, scale, scale));
GUI.EndGroup ();
}
示例10: EventHandlerDesc
public EventHandlerDesc(string name, Type type, Texture icon, string tooltip)
{
Name = name;
Type = type;
Icon = icon;
Tooltip = tooltip;
}
示例11: GUIContent
public GUIContent(Texture image, string tooltip)
{
this.m_Text = string.Empty;
this.m_Tooltip = string.Empty;
this.m_Image = image;
this.m_Tooltip = tooltip;
}
示例12: DescriptorAttribute
public DescriptorAttribute(string name, string description, Texture icon, Color color)
{
this.name = name;
this.comment = description;
this.icon = icon;
this.color = color;
}
示例13: CreateFromTexture
public static tk2dSpriteCollectionData CreateFromTexture(Texture texture, SpriteCollectionSize size, string[] names, Rect[] regions, Vector2[] anchors)
{
GameObject go = new GameObject("SpriteCollection");
tk2dSpriteCollectionData sc = go.AddComponent<tk2dSpriteCollectionData>();
sc.Transient = true;
sc.version = tk2dSpriteCollectionData.CURRENT_VERSION;
sc.invOrthoSize = 1.0f / size.orthoSize;
sc.halfTargetHeight = size.targetHeight * 0.5f;
sc.premultipliedAlpha = false;
sc.material = new Material(Shader.Find("tk2d/BlendVertexColor"));
sc.material.mainTexture = texture;
sc.materials = new Material[1] { sc.material };
sc.textures = new Texture[1] { texture };
float scale = 2.0f * size.orthoSize / size.targetHeight;
// Generate geometry
sc.spriteDefinitions = new tk2dSpriteDefinition[regions.Length];
for (int i = 0; i < regions.Length; ++i)
{
sc.spriteDefinitions[i] = CreateDefinitionForRegionInTexture(texture, scale, regions[i], anchors[i]);
sc.spriteDefinitions[i].name = names[i];
}
foreach (var def in sc.spriteDefinitions)
def.material = sc.material;
return sc;
}
示例14: registerItem
public static void registerItem(String id, Texture invTexture, GameObject model)
{
if (items.ContainsKey(id))
throw new Exception("Cannot have two items with the same id (" + id + ")");
items[id] = new ItemData(invTexture, model);
}
示例15: PipeTextures
protected void PipeTextures()
{
RefreshTextureScript rts = this.GetComponent<RefreshTextureScript>();
if (rts != null) {
this.source = rts.toReplace;
} else {
//grab original base texture. this is source.
this.source = this.renderer.material.GetTexture("_MainTex");
}
if ((this.source as RenderTexture) != null) {
RenderTexture s = this.source as RenderTexture;
//create new destination texture.
this.destination = new RenderTexture(s.width,s.height,s.depth);
} else {
this.destination = new RenderTexture(source.width,source.height,24);
}
//assign destination texture to existing shader.
if (rts != null) {
rts.toReplace = this.destination;
} else {
this.renderer.material.SetTexture("_MainTex",this.destination);
}
}