private string _GetCustomFont(long nValue, eCustomFontType eType) { if( nValue < 0) nValue = 0; char[] FontBuf = new char[10]; if( eCustomFontType.eCustomFontType_HP == eType) FontBuf = m_GreenFontBuf; else if( eCustomFontType.eCustomFontType_MP == eType || eCustomFontType.eCustomFontType_MIRACLE == eType) FontBuf = m_BlueFontBuf; else if( eCustomFontType.eCustomFontType_GOLD == eType || eCustomFontType.eCustomFontType_ArkPoint == eType) FontBuf = m_YellowFontBuf; else if( eCustomFontType.eCustomFontType_EXP1 == eType) FontBuf = ( 0 == nValue) ? m_RedFontBuf_User : m_WhiteFontBuf; else if( eCustomFontType.eCustomFontType_EXP2 == eType) FontBuf = m_BlueFontBuf; else if( eCustomFontType.eCustomFontType_AllyDamage == eType) FontBuf = m_RedFontBuf_User; else return ""; int nBuf = 0; string str = nValue.ToString(); char[] strBuf = new char[str.Length]; for( int i = 0; i < str.Length; i++) { nBuf = int.Parse( str[i].ToString()); strBuf[i] = FontBuf[nBuf]; } string strRes = new string( strBuf); return strRes; }
private string _GetCustomFont(int nValue, eCustomFontType eType) { return _GetCustomFont( (long)nValue, eType); }
// UserPlayer Only( gold, exp) public void ShowNumberPanel(long nValue, eCustomFontType eType) { if ((0 >= nValue) && ((eCustomFontType.eCustomFontType_GOLD == eType) || (eCustomFontType.eCustomFontType_EXP2 == eType) || (eCustomFontType.eCustomFontType_MIRACLE == eType) || (eCustomFontType.eCustomFontType_ArkPoint == eType))) return; Transform charTransform = CameraMgr.Instance.GetPlayerCharacterTransform(); if( null == charTransform) return; AsUserEntity userEntity = AsUserInfo.Instance.GetCurrentUserEntity(); if( null == userEntity) return; string str = _GetCustomFont( nValue, eType); int nUIYPosRevisionFlag = 0; float fSpeed = 1.0f; float fScale = 1.0f; if( eCustomFontType.eCustomFontType_GOLD == eType) { str = str + '$'; if( Time.time - m_fShowTime_Exp < 0.2f) nUIYPosRevisionFlag = 2; m_fShowTime_Gold = Time.time; fSpeed = m_fSpeed_Damage_Gold; fScale = m_fScale_Damage_Gold; } else if (eCustomFontType.eCustomFontType_MIRACLE == eType) { str = str + '~'; if (Time.time - m_fShowTime_Exp < 0.2f) nUIYPosRevisionFlag = 2; m_fShowTime_Gold = Time.time; fSpeed = m_fSpeed_Damage_Gold; fScale = m_fScale_Damage_Gold; } else if (eCustomFontType.eCustomFontType_EXP1 == eType) { if (0 == nValue) str += '-'; else str += '&'; if (Time.time - m_fShowTime_Gold < 0.2f) nUIYPosRevisionFlag = 2; m_fShowTime_Exp = Time.time; fSpeed = m_fSpeed_Damage_Exp; fScale = m_fScale_Damage_Exp; } else if (eCustomFontType.eCustomFontType_EXP2 == eType) { str = str + '('; StartCoroutine(_ShowExp2(charTransform.gameObject, str, nUIYPosRevisionFlag, false, false, m_fSpeed_Damage_Exp2, m_fScale_Damage_Exp2)); // exp2 return; } else if (eCustomFontType.eCustomFontType_ArkPoint == eType) { str = str + ':'; if (Time.time - m_fShowTime_Exp < 0.2f) nUIYPosRevisionFlag = 2; m_fShowTime_Gold = Time.time; fSpeed = m_fSpeed_Damage_Gold; fScale = m_fScale_Damage_Gold; } _ShowNumberPanel( charTransform.gameObject, str, nUIYPosRevisionFlag, false, false, fSpeed, fScale); // gold, exp }
// UserPlayer Only( gold) public void ShowNumberPanel(int nValue, eCustomFontType eType) { ShowNumberPanel( (long)nValue, eType); }
// hp, mp public void ShowNumberPanel(AsUserEntity userEntity, int nValue, eATTRCHANGECONTENTS eContents, eCustomFontType eType, eDAMAGETYPE eDamageType) { if( null == userEntity) return; if( eATTRCHANGECONTENTS.eATTRCHANGECONTENTS_USING_SKILL == eContents || eATTRCHANGECONTENTS.eATTRCHANGECONTENTS_KILLNPC == eContents) { if( nValue <= 0) return; int nRes = nValue; float fSpeed = 1.0f; float fScale = 1.2f; if( eCustomFontType.eCustomFontType_HP == eType) { float maxHP = userEntity.GetProperty<float>( eComponentProperty.HP_MAX); float curHP = userEntity.GetProperty<float>( eComponentProperty.HP_CUR); float subHP = maxHP - curHP; if( subHP < nValue) nRes = (int)subHP; fSpeed = m_fSpeed_Damage_HP; fScale = m_fScale_Damage_HP; } else if( eCustomFontType.eCustomFontType_MP == eType) { float maxMP = userEntity.GetProperty<float>( eComponentProperty.MP_MAX); float curMP = userEntity.GetProperty<float>( eComponentProperty.MP_CUR); float subMP = maxMP - curMP; if( subMP < nValue) nRes = (int)subMP; fSpeed = m_fSpeed_Damage_MP; fScale = m_fScale_Damage_MP; } if( nRes >= 0) { if( eDAMAGETYPE.eDAMAGETYPE_CRITICAL == eDamageType) _ShowNumberPanel( userEntity.transform.gameObject, "!", 2, true, true, m_fSpeed_Damage_Critical, m_fScale_Damage_Critical); // critical user string str = _GetCustomFont( nRes, eType); _ShowNumberPanel( userEntity.transform.gameObject, str, 0, false, false, fSpeed, fScale); // HP, MP user } } else if( eATTRCHANGECONTENTS.eATTRCHANGECONTENTS_DOT_DAMAGE == eContents) { // if( nValue <= 0) // return; // // float maxHP = userEntity.GetProperty<float>( eComponentProperty.HP_MAX); // float curHP = userEntity.GetProperty<float>( eComponentProperty.HP_CUR); // float subHP = maxHP - curHP; // int nRes = nValue; // if( subHP < nValue) // nRes = (int)subHP; // // if( nRes > 0) // { // string str = _GetCustomFont( nRes, eType); // _ShowNumberPanel( userEntity.transform.gameObject, str, 0, false, false, m_fSpeed_Damage_DotHeal, m_fScale_Damage_DotHeal); // Dot Healling user // } string str = ""; int nRes = nValue; if( nValue <= 0) { nRes *= -1; //str = nRes.ToString(); // dot damage str = _GetCustomFont( nRes, eCustomFontType.eCustomFontType_AllyDamage); } else str = _GetCustomFont( nRes, eType); // dot healling _ShowNumberPanel( userEntity.transform.gameObject, str, 0, false, false, m_fSpeed_Damage_DotHeal, m_fScale_Damage_DotHeal); // Dot Healling user } else if( eATTRCHANGECONTENTS.eATTRCHANGECONTENTS_HP_INSTEAD_MP == eContents) { int nRes = nValue; if( nValue <= 0) nRes *= -1; if( eDAMAGETYPE.eDAMAGETYPE_CRITICAL == eDamageType) _ShowNumberPanel( userEntity.transform.gameObject, "!", 2, true, true, m_fSpeed_Damage_Critical, m_fScale_Damage_Critical); // critical user _ShowNumberPanel( userEntity.transform.gameObject, nRes.ToString(), 0, true, false, m_fSpeed_Damage, m_fScale_Damage); // damage(red font) } }
// hp, mp public void ShowNumberPanel(AsUserEntity userEntity, int nValue, eATTRCHANGECONTENTS eContents, eCustomFontType eType) { ShowNumberPanel( userEntity, nValue, eContents, eType, eDAMAGETYPE.eDAMAGETYPE_NORMAL); }