Example #1
0
    /// <summary>
    /// 显示战损单位信息
    /// </summary>
    /// <param name="result"></param>
    /// <returns></returns>
    private IEnumerator ShowLostUnits(proto.S2CFightReport result)
    {
        int lostUnitSize = result.lostunit_size();

        if (lostUnitSize == 0)
        {
            NoLostNoteText_.enabled = true;
            NoLostNoteText_.text    = "No unit loss, congratulation!";
            yield break;
        }
        for (int i = 0; i < lostUnitSize; i++)
        {
            proto.LostUnitInfo info     = result.lostunit(i);
            string             iconName = GlobalConfig.GetUnitReference(info.refid).iconfile;
            Debug.Log("lost iocnName : " + iconName);
            GameObject obj = Global.CreateUI("lostunit", LostUnitContentRoot_.gameObject);
            obj.name = string.Format("_lost_id_{0}", info.refid);
            Image iconImg    = obj.GetComponent <Image>();
            Text  amountText = obj.GetComponentInChildren <Text>();
            Global.SetSprite(iconImg, iconName, true);
            amountText.text = string.Format("x{0}", info.amount);

            yield return(new WaitForSeconds(0.5f));
        }
        yield return(null);
    }
Example #2
0
 /// <summary>
 /// 填充损失单位信息
 /// </summary>
 private void FillLostUnitInfo()
 {
     foreach (var lostInfo in LostUnitDict_)
     {
         proto.LostUnitInfo info = new proto.LostUnitInfo();
         info.refid  = lostInfo.Key;
         info.amount = lostInfo.Value;
         ReportMsg_.add_lostunit(info);
     }
 }