using System.Collections; using System.Collections.Generic; using UnityEngine; /* 内置角色信息管理者,(PK模式用到的角色选择) */ public class RoleMgr { static string[] roleNames = {"海绵宝宝", "方狗狗", "五六七", "CHANEL", "Mimi", "喵了个咪"}; public static int roleCount { get { return roleNames.Length; } } public static (Sprite, string) GetRoleInfo(int id) { Sprite sprite = GetAvatar(id); string nickname = null; if (IsRoleAvatar(id)) { nickname = roleNames[id - 1]; } else { nickname = LoginMgr.myUserInfo.nickname; } return (sprite, nickname); } public static bool IsRoleAvatar(int id) { return id >= 1 && id <= 6; } public static int GetAvatarListLen() { return 7 + 24; } public static Sprite GetAvatar(int id) { string path = "Textures/Avatar/"; if (id < 7) path += "Player" + id; else path += id - 7; return Resources.Load(path); } }