网上演练贵港万达广场(人员密集)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

67 lines
2.0 KiB

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class LoadHeadPortrait : MonoBehaviour
{
public Image head;
public Text UserRealName;
public Text OrganizationName;
private string HeadSpritName = "HeadDefaut.png";
private void Start()
{
HeadPortraitSet();
}
private void HeadPortraitSet()
{
GetHeadSprit(HeadSpritName);//设置头像
UserRealName.text = CurrentUserInfo.mySelf.RealName;//设置用户真实姓名
if (GameSettings.othersSettings.mode == Mode.DisasterManagement)
{
UserRealName.text = CurrentUserInfo.mySelf.RealName + "(灾情库管理员)";
}
else
{
if (CurrentUserInfo.role != Role. ||
CurrentUserInfo.role != Role. ||
CurrentUserInfo.role != Role. ||
CurrentUserInfo.role != Role.)
{
UserRealName.text += "(" + CurrentUserInfo.role.ToString() + ")";
}
}
//设置组织机构名
//注:类似灾情苦管理界面没有进入角色选择,组织机构名赋值为空
OrganizationName.text = CurrentUserInfo.organization == null ? "" : CurrentUserInfo.organization.DisplayName;
}
private void GetHeadSprit(string SpritName)
{
string path = "file://" + Application.streamingAssetsPath + "/HeadImages/" + SpritName;
StartCoroutine(Load(path));
}
IEnumerator Load(string path)
{
Debug.Log(path);
WWW www = new WWW(path);
yield return www;
if (!string.IsNullOrEmpty(www.error))
{
Debug.Log(www.error);
}
else
{
if (www.isDone)
{
Texture2D tex = www.texture;
head.sprite = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), Vector2.zero);
}
}
}
}