コード例 #1
0
 void UpdateShow()
 {
     if (arrowImage != null)
     {
         UGUISpriteSelector selector = arrowImage.GetComponent <UGUISpriteSelector>();
         if (selector == null)
         {
             arrowImage.gameObject.AddComponent <UGUISpriteSelector>();
             selector = arrowImage.GetComponent <UGUISpriteSelector>();
         }
         selector.index = group;
     }
     if (bgImage != null)
     {
         UGUISpriteSelector selector = bgImage.GetComponent <UGUISpriteSelector>();
         if (selector == null)
         {
             bgImage.gameObject.AddComponent <UGUISpriteSelector>();
             selector = bgImage.GetComponent <UGUISpriteSelector>();
         }
         selector.index = group;
     }
 }
コード例 #2
0
ファイル: CharacterIcon.cs プロジェクト: ZengHuiAn/sgk
 void UpdateIcon()
 {
     if (characterIcon != null)
     {
         characterIcon.gameObject.SetActive(_icon != "");
         if (_icon != "")
         {
             if (_icon != "0")
             {
                 characterIcon.LoadSprite(string.Format("icon/{0}", _icon));
             }
             else//如果 icon为 0 使用特殊 Icon
             {
                 UGUISpriteSelector selector = characterIcon.GetComponent <UGUISpriteSelector>();
                 if (selector == null)
                 {
                     characterIcon.gameObject.AddComponent <UGUISpriteSelector>();
                     selector = characterIcon.GetComponent <UGUISpriteSelector>();
                 }
                 selector.index = 0;
             }
         }
     }
 }