0312 增加GM功能;封包接收去除旧代码;共用预制体改目录UIComp;共用UI颜色调整
| | |
| | |
|
| | | MainRedDot.Instance.Register();
|
| | | StageManager.Instance.ToGameScene();
|
| | |
|
| | | if (DebugUtility.Instance.debugAccount)
|
| | | {
|
| | | GMCommand.Instance.Begin();
|
| | | }
|
| | |
|
| | | //SettingMgr.Instance.SetIsRecordData(PlayerDatas.Instance.baseData.PlayerID.ToString());
|
| | |
|
| | |
| | | // 实例化并强转为协议包基类 |
| | | var packageInstance = packageType.Assembly.CreateInstance(packageType.Name) as GameNetPackBasic; |
| | | packageInstance.ReadFromBytes(vBytes);// 解析内容 |
| | | if (packageInstance.cmd == (ushort)0x03F0 || packageInstance.cmd == (ushort)0x1801) |
| | | { |
| | | byte[] vPyBody = new byte[vBytes.Length - 4]; |
| | | Array.Copy(vBytes, 4, vPyBody, 0, vPyBody.Length); |
| | | packageInstance = TransForPyPack(vPyBody); |
| | | } |
| | | |
| | | packageInstance.socketType = socketType; |
| | | #if UNITY_EDITOR |
| | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 解析PY的模拟包 |
| | | /// </summary> |
| | | /// <param name="vBytes"></param> |
| | | /// <returns></returns> |
| | | private static GameNetPackBasic TransForPyPack(byte[] vBytes) |
| | | { |
| | | GameNetPackBasic vNetPackInst = null; |
| | | ushort vPackCmd = (ushort)((ushort)(vBytes[0] << 8) + vBytes[1]); |
| | | // 主工程封包 |
| | | if (packageTable.ContainsKey(vPackCmd)) |
| | | { |
| | | Type vNetPackType = packageTable[vPackCmd]; |
| | | vNetPackInst = vNetPackType.Assembly.CreateInstance(vNetPackType.Name) as GameNetPackBasic; |
| | | vNetPackInst.ReadFromBytes(vBytes);// 解析内容 |
| | | } |
| | | else |
| | | { |
| | | Debug.Log("收到未定义的解包协议:" + vBytes[0].ToString("x2").ToUpper() + "," + vBytes[1].ToString("x2").ToUpper()); |
| | | } |
| | | return vNetPackInst; |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | static byte[] vCmdBytes = new byte[2]; |
| | | /// <summary> |
| | | /// 阅读信息 |
| | | /// 解析数据包: FFCC+封包长度+封包(封包头+数据)结构体内容 |
| | | /// </summary> |
| | | /// <param name="vBytes"></param> |
| | | private void ReadInfo(byte[] vBytes) |
| | |
| | | |
| | | public static GameObject LoadPrefab(string _name) |
| | | { |
| | | return ResManager.Instance.LoadAsset<GameObject>("Prefab", _name); |
| | | return ResManager.Instance.LoadAsset<GameObject>("UIComp", _name); |
| | | } |
| | | |
| | | public static void UnLoadPrefab(string _assetName) |
| | | { |
| | | ResManager.Instance.UnloadAsset("Prefab", _assetName); |
| | | ResManager.Instance.UnloadAsset("UIComp", _assetName); |
| | | } |
| | | |
| | | public static Sprite LoadSprite(string _iconKey) |
| | |
| | |
|
| | | protected override void OnOpen()
|
| | | {
|
| | | base.HandleOpen();
|
| | | this.transform.SetAsLastSibling();
|
| | | }
|
| | | protected void LateUpdate()
|
| | |
| | | /// </summary> |
| | | public class HomeWin : UIBase |
| | | { |
| | | [SerializeField] AvatarCell avatarCell; |
| | | [SerializeField] Text playerNameText; |
| | | [SerializeField] Text powerText; |
| | | [SerializeField] Text rankName; |
| | | [SerializeField] Text playerLevelText; |
| | | [SerializeField] Slider expSlider; |
| | | [SerializeField] Text goldText; |
| | | [SerializeField] Text diamondText; |
| | | /// <summary> |
| | | /// 初始化组件 |
| | | /// </summary> |
| | |
| | | using System.Collections.Generic;
|
| | | using UnityEngine;
|
| | |
|
| | | //头像模块(支持帧动画和特效)
|
| | | public class AvatarCell : MonoBehaviour
|
| | | {
|
| | | public float scale = 1.0f;
|
| | |
|
| | | private void Awake()
|
| | | {
|
| | | LoadPrefab();
|
| | |
|
| | | }
|
| | | ImageEx m_BgImage;
|
| | | public ImageEx bgImage
|
| | | {
|
| | |
| | | {
|
| | | if (m_BgImage == null)
|
| | | {
|
| | | LoadPrefab();
|
| | | m_BgImage = this.GetComponent<ImageEx>("AvatarCell/Img_BG");
|
| | | }
|
| | | return m_BgImage;
|
| | |
| | | {
|
| | | if (m_AvatarImage == null)
|
| | | {
|
| | | LoadPrefab();
|
| | | m_AvatarImage = this.GetComponent<ImageEx>("AvatarCell/Img_Avatar");
|
| | | }
|
| | | return m_AvatarImage;
|
| | |
| | | {
|
| | | if (m_AvatarFrameImage == null)
|
| | | {
|
| | | LoadPrefab();
|
| | | m_AvatarFrameImage = this.GetComponent<ImageEx>("AvatarCell/Img_AvatarFrame");
|
| | | }
|
| | | return m_AvatarFrameImage;
|
| | |
| | | {
|
| | | if (m_button == null)
|
| | | {
|
| | | LoadPrefab();
|
| | | m_button = this.GetComponent<ButtonEx>("AvatarCell/Img_AvatarFrame");
|
| | | }
|
| | | return m_button;
|
| | |
| | | {
|
| | | if (m_AvatarUIFrame == null)
|
| | | {
|
| | | LoadPrefab();
|
| | | m_AvatarUIFrame = this.GetComponent<UIFrame>("AvatarCell/Img_Avatar");
|
| | | }
|
| | | return m_AvatarUIFrame;
|
| | |
| | | {
|
| | | if (m_AvatarFrameUIFrame == null)
|
| | | {
|
| | | LoadPrefab();
|
| | | m_AvatarFrameUIFrame = this.GetComponent<UIFrame>("AvatarCell/Img_AvatarFrame");
|
| | | }
|
| | | return m_AvatarFrameUIFrame;
|
| | |
| | | {
|
| | | if (m_AvatarUIEffect == null)
|
| | | {
|
| | | LoadPrefab();
|
| | | m_AvatarUIEffect = this.GetComponent<UIEffect>("AvatarCell/Img_Avatar");
|
| | | }
|
| | | return m_AvatarUIEffect;
|
| | |
| | | {
|
| | | if (m_AvatarFrameUIEffect == null)
|
| | | {
|
| | | LoadPrefab();
|
| | | m_AvatarFrameUIEffect = this.GetComponent<UIEffect>("AvatarCell/Img_AvatarFrame");
|
| | | }
|
| | | return m_AvatarFrameUIEffect;
|
| | |
| | |
|
| | | protected void LoadPrefab()
|
| | | {
|
| | | if (prefab != null)
|
| | | return;
|
| | | var tmp = transform.Find("AvatarCell");
|
| | |
|
| | | if (tmp != null)
|
| | |
| | | prefab = tmp.gameObject;
|
| | | return;
|
| | | }
|
| | | if (prefab == null)
|
| | | {
|
| | | prefab = UIUtility.CreateWidget("AvatarCell", "AvatarCell");
|
| | |
|
| | | if (prefab != null)
|
| | | {
|
| | | prefab.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
|
| | | prefab.transform.SetAsFirstSibling();
|
| | |
|
| | |
| | | prefabRect.anchorMax = new Vector2(0.5f, 0.5f);
|
| | | prefabRect.sizeDelta = new Vector2(parentRect.rect.width, parentRect.rect.height);
|
| | | prefabRect.localScale = new Vector3(scale, scale, scale);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | ScrollTipDetail tip = null; |
| | | if (pool == null) |
| | | { |
| | | var _prefab = ResManager.Instance.LoadAsset<GameObject>("Prefab", "Tip");// UILoader.LoadPrefab("Tip"); |
| | | var _prefab = ResManager.Instance.LoadAsset<GameObject>("UIComp", "Tip");// UILoader.LoadPrefab("Tip"); |
| | | pool = GameObjectPoolManager.Instance.RequestPool(_prefab); |
| | | } |
| | | if (pool != null) |
| | |
| | | default23, |
| | | default24, |
| | | default25, |
| | | default26, |
| | | default26, // 254 战锤 |
| | | default27, |
| | | default28, |
| | | default29, |
| | | default30, |
| | | default31, |
| | | default32, |
| | | default33, |
| | | default33, // 261 结晶 |
| | | default34, // 262 凭证积分 |
| | | default35, // 263 聚魂精华 |
| | | default36, // 264 Boss最终伤害加成 |
| | |
| | |
|
| | | public class GMCommand : SingletonMonobehaviour<GMCommand>
|
| | | {
|
| | | public void Begin()
|
| | | { |
| | | }
|
| | |
|
| | | private void Update()
|
| | | {
|
| | | if (Input.GetKeyDown(KeyCode.F1))
|
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 文字色值 |
| | | #region 文字色值 Bright 和 Dark指背景色系是明还是暗,暗底亮字,亮底暗字的规则 |
| | | public static readonly Color s_BrightPinkColor = new Color32(246, 64, 141, 255); |
| | | public static readonly Color s_BrightRedColor = new Color32(255, 3, 3, 255); |
| | | public static readonly Color s_BrightPurpleColor = new Color32(218, 72, 213, 255); |
| | | public static readonly Color s_BrightBlueColor = new Color32(0, 107, 227, 255); //006BE3FF |
| | | public static readonly Color s_BrightOrangeColor = new Color32(255, 103, 1, 255); //FF6701FF |
| | | public static readonly Color s_BrightWhiteColor = new Color32(104, 104, 104, 255); //686868 |
| | | public static readonly Color s_BrightGreenColor = new Color32(16, 157, 6, 255); //109d06 |
| | | public static readonly Color s_BrightGreenColor = new Color32(36, 139, 18, 255); //248b12 |
| | | |
| | | public static readonly Color s_DarkPinkColor = new Color32(255, 124, 124, 255); |
| | | public static readonly Color s_DarkRedColor = new Color32(250, 1, 1, 255); |
| | |
| | | public static readonly Color s_DarkBlueColor = new Color32(49, 206, 251, 255);//31cefb |
| | | public static readonly Color s_DarkOrangeColor = new Color32(248, 152, 59, 255); |
| | | public static readonly Color s_DarkWhiteColor = new Color32(247, 247, 247, 255); |
| | | public static readonly Color s_DarkGreenColor = new Color32(53, 225, 34, 255); //35e122 |
| | | public static readonly Color s_DarkGreenColor = new Color32(42, 227, 55, 255);//2ae337 |
| | | |
| | | public static readonly Color s_NavyBrown = new Color32(64, 28, 6, 255);//401c06 |
| | | public static readonly Color s_NavyBrown = new Color32(110, 76, 49, 255);//6e4c31 |
| | | public static readonly Color s_Black = new Color32(0, 0, 0, 255); |
| | | public static readonly Color s_NavyYellow = new Color32(255, 239, 71, 255); |
| | | public static readonly Color s_LightGreen = new Color32(141, 220, 17, 255);//8ddc11 |
| | | public static readonly Color s_LightYellow = new Color32(255, 244, 205, 255); //fff4cd |
| | | public static readonly Color s_LightGreen = new Color32(42, 227, 55, 255);//2ae337 |
| | | public static readonly Color s_LightYellow = new Color32(245, 246, 230, 255); //f5f6e6 |
| | | public static readonly Color s_Gray = new Color32(204, 204, 204, 255); |
| | | public static readonly Color s_Gold = new Color32(255, 239, 71, 255);//ffef47 |
| | | public static readonly Color s_EarthYellow = new Color32(248, 152, 59, 255);//f8983b |
| | |
| | | |
| | | public static Color GetUIColor(TextColType type, bool bright = false) |
| | | { |
| | | //Bright 和 Dark指背景色系是明还是暗,暗底亮字,亮底暗字的规则 |
| | | switch (type) |
| | | { |
| | | case TextColType.None: |
| | |
| | | case TextColType.Green: |
| | | return StringUtility.Contact("<color=#", bright ? "109d06" : "35e122", ">", msg, "</color>"); |
| | | case TextColType.NavyBrown: |
| | | return StringUtility.Contact("<color=#", "401c06", ">", msg, "</color>"); |
| | | return StringUtility.Contact("<color=#", "6e4c31", ">", msg, "</color>"); |
| | | case TextColType.DarkGreen: |
| | | return StringUtility.Contact("<color=#", "109d06", ">", msg, "</color>"); |
| | | case TextColType.Black: |
| | | return StringUtility.Contact("<color=#", "000000", ">", msg, "</color>"); |
| | | case TextColType.LightYellow: |
| | | return StringUtility.Contact("<color=#", "fff4cd", ">", msg, "</color>"); |
| | | return StringUtility.Contact("<color=#", "f5f646", ">", msg, "</color>"); |
| | | case TextColType.LightGreen: |
| | | return StringUtility.Contact("<color=#", "8ddc11", ">", msg, "</color>"); |
| | | case TextColType.Gray: |
| | |
| | | } |
| | | case 41: |
| | | { |
| | | //符印精华 |
| | | return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.RuneSplinters); |
| | | //战锤 |
| | | return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.default26); |
| | | } |
| | | case 42: |
| | | { |
| | | //结晶 |
| | | return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.default33); |
| | | } |
| | | case 43: |
| | | { |