mirror of
https://github.com/RaindropViewer/RaindropViewer.git
synced 2026-07-27 22:11:39 +00:00
27 lines
767 B
C#
27 lines
767 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Raindrop.Presenters
|
|
{
|
|
// An implementation of view. Attach to GO that has rawimage.
|
|
// refers to a single texture; a single tile. can refer to many sims on a single tile.
|
|
[RequireComponent(typeof(RawImage))]
|
|
public class MapTileView : MonoBehaviour
|
|
{
|
|
public void setRawImage(Texture2D img)
|
|
{
|
|
//hack: delete old texture before loading new one
|
|
|
|
if (this.GetComponent<RawImage>().texture != null)
|
|
{
|
|
UnityEngine.Object.Destroy(this.GetComponent<RawImage>().texture);
|
|
}
|
|
this.GetComponent<RawImage>().texture = img;
|
|
|
|
}
|
|
}
|
|
}
|