本文整理汇总了C#中UIWidget类的典型用法代码示例。如果您正苦于以下问题:C# UIWidget类的具体用法?C# UIWidget怎么用?C# UIWidget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UIWidget类属于命名空间,在下文中一共展示了UIWidget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnInit
public override void OnInit()
{
base.OnInit();
m_SpriteMyIcon = FindChildComponent<UISprite>("Sprite_Icon1");
m_SpriteOtherIcon = FindChildComponent<UISprite>("Sprite_Icon0");
m_ObjButtonRoot = FindChild("ButtonRoot");
m_ObjButtonOk = FindChild("Button_Ok");
m_ObjButtonCancle = FindChild("Button_Cancle");
m_LabelMyName = FindChildComponent<UILabel>("Label_Name1");
m_LabelOtherName = FindChildComponent<UILabel>("Label_Name2");
var obj = FindChild("Button_Talk");
UIEventListener.Get(obj).onPress = OnPressButton;
AddChildElementClickEvent(OnClickBack, "Sprite_Exit");
m_DropPanel = FindChildComponent<UIWidget>("DrapPanel");
m_FireworkPlanList = new List<FireworkPlanElement>();
for (int i = 0; i < 7; ++i)
{
var objRoot = FindChild("Type_" + i);
FireworkPlanElement elem = new FireworkPlanElement(objRoot);
elem.SetStatus(true,ItemManager.Instance.IsExistItem(i));
m_FireworkPlanList.Add(elem);
MyUIDragDropItem drag = objRoot.GetComponent<MyUIDragDropItem>();
drag.RegisterDragEndAction(OnDragEnd);
//UIEventListener.Get(objRoot).onClick = OnClickItem;;
}
m_ObjButtonRoot.SetActive(false);
m_SpriteMyIcon.gameObject.SetActive(false);
m_SpriteOtherIcon.gameObject.SetActive(false);
m_LabelOtherName.text = string.Empty;
m_LabelMyName.text = PlayerManager.Instance.GetCharBaseData().CharName;
}
示例2: SetRank
IEnumerator SetRank(){
//StartCoroutine("Wait", 5f);
//yield return new WaitForSeconds (2f);
GameObject.Find("Panel").transform.FindChild("Rank").gameObject.SetActive(true);
GameObject.Find("Panel").transform.FindChild("RankText").gameObject.SetActive(true);
wg2 = GameObject.Find("Panel").transform.FindChild("RankText").GetComponent<UIWidget>();
trueRankText = true;
//StartCoroutine("Wait", 2f);
yield return new WaitForSeconds(3f);
if (num >= 60) {
GameObject.Find ("Rank").transform.FindChild("DRank").gameObject.SetActive (true);
wg = GameObject.Find ("Rank").transform.FindChild("DRank").GetComponent<UIWidget>();
} else if (num >= 40) {
GameObject.Find ("Rank").transform.FindChild("CRank").gameObject.SetActive (true);
wg = GameObject.Find ("Rank").transform.FindChild("CRank").GetComponent<UIWidget>();
} else if (num >= 20) {
GameObject.Find ("Rank").transform.FindChild("BRank").gameObject.SetActive (true);
wg = GameObject.Find ("Rank").transform.FindChild("BRank").GetComponent<UIWidget>();
}else if (num > 10) {
GameObject.Find ("Rank").transform.FindChild("ARank").gameObject.SetActive (true);
wg = GameObject.Find ("Rank").transform.FindChild("ARank").GetComponent<UIWidget>();
} else if (num > 0) {
GameObject.Find ("Rank").transform.FindChild("SRank").gameObject.SetActive (true);
wg = GameObject.Find ("Rank").transform.FindChild("SRank").GetComponent<UIWidget>();
}
trueRank = true;
}
示例3: FadeAlphaRank
public void FadeAlphaRank(UIWidget w){
Debug.Log ("wid"+fAlpha+"aa"+w.alpha);
if(w.alpha < 255f){
w.alpha += fAlpha;
Debug.Log ("wid"+fAlpha+"aa"+w.alpha);
}
}
示例4: Update
// Update is called once per frame
void Update () {
#if UNITY_EDITOR
if (host == null)
{
host = GetComponent<UIWidget>();
}
if (processBar == null)
{
processBar = NGUITools.FindInParents<UIProgressBar>(gameObject);
}
#endif
if(host == null)
return;
if (uiCamera == null) uiCamera = NGUITools.FindCameraForLayer(gameObject.layer);
Rect mRect = uiCamera.pixelRect;
Vector3 v = new Vector3(mRect.xMax, 0f, 0f);
v = uiCamera.ScreenToWorldPoint(v);
Vector3 lp = this.transform.InverseTransformPoint(v);
int newWidth = (int)lp.x;
if (newWidth != oldWidth)
{
oldWidth = newWidth;
host.width = (int)lp.x;
if (processBar != null)
processBar.ForceUpdate();
}
}
示例5: CompareFunc
public static int CompareFunc(UIWidget left, UIWidget right)
{
int num = UIPanel.CompareFunc(left.mPanel, right.mPanel);
if (num != 0)
{
return num;
}
if (left.mDepth < right.mDepth)
{
return -1;
}
if (left.mDepth > right.mDepth)
{
return 1;
}
Material material = left.material;
Material material2 = right.material;
if (material == material2)
{
return 0;
}
if (material != null)
{
return -1;
}
if (material2 != null)
{
return 1;
}
return ((material.GetInstanceID() >= material2.GetInstanceID()) ? 1 : -1);
}
示例6: Start
void Start () {
btnClose = transform.FindInChildren("btnBack").GetComponent<UIButton>();
scrEvents = transform.FindInChildren("scrEvent").GetComponent<UIScrollView>();
tplEvent = transform.FindInChildren("itemEvent").GetComponent<UIWidget>();
tplEvent.gameObject.SetActive(false);
tplEvent.transform.parent = null;
}
示例7: Start
void Start()
{
m_widget = GetComponent<UIWidget>();
m_size = m_widget.localSize;
SetAlignWidgets();
}
示例8: initializeUI
void initializeUI()
{
arrowUI = GameObject.Find ("Arrow").gameObject;
speedUI = GameObject.Find ("speed").GetComponent<UILabel>();
gearstUI = GameObject.Find ("peredacha").GetComponent<UILabel> ();
nitroUI = GameObject.Find ("indikator").GetComponent<UIWidget> ();
}
示例9: SetAlign
void SetAlign(UIWidget widget, float posY)
{
Vector2 pos = widget.transform.localPosition;
switch (m_align)
{
case Align.NONE:
break;
case Align.CENTER:
pos.y = 0;
break;
case Align.TOP:
pos.y = m_size.y / 2;
break;
case Align.BOTTOM:
pos.y = m_size.y / 2 * -1;
break;
default:
break;
}
pos.y -= posY;
widget.transform.localPosition = pos;
}
示例10: CalculateWidgetLocalBounds
public static Bounds CalculateWidgetLocalBounds( UIWidget w, Transform relativeTo ) {
float width = w.cachedTransform.localScale.x;
float height = w.cachedTransform.localScale.y;
Vector2 pivotOffset = w.pivotOffset;
return new Bounds( GetLocalOffset( w.transform, relativeTo ) + new Vector3( 0.5f*pivotOffset.x*width, 0.5f*pivotOffset.y*height, 0f ), new Vector3( width, height, 0f ) );
}
示例11: fromXML
public static XmlNodeList fromXML(XmlNode node, out UIWidget ui, UIWidget p)
{
string text = "";
float width = 128;
int rows = 1;
int fontSz = 10;
uint color = 0xffffffff;
EStyle style = EStyle.normal;
var ret = node.Attributes.GetNamedItem("text");
if (ret != null) text = ret.Value;
bool br = false;
text = getProp<string>(node, "text", "template", out br);
width = getProp(node, "width", 128, out br);
rows = getProp(node, "rows", rows, out br);
color = (uint)getProp<EColorUtil>(node, "color", (EColorUtil)schemes.textColor, out br);
if (!br)
{
color = getProp(node, "color", (uint)(schemes.textColor), out br);
}
style = UILabel.getStyle(node);
fontSz = getProp(node, "size", fontSz, out br);
ui = new UIEdit(text, fontSz, (int)width, rows, color, style);
ui.fromXML(node);
ui.paresent = p;
return node.ChildNodes;
}
示例12: SetSpriteBySelection
public void SetSpriteBySelection()
{
if (UIPopupList.current != null)
{
if (this.mWidget == null)
{
this.mWidget = base.GetComponent<UIWidget>();
}
string key = UIPopupList.current.value;
if (key != null)
{
int num;
if (<>f__switch$map1 == null)
{
Dictionary<string, int> dictionary = new Dictionary<string, int>(7);
dictionary.Add("White", 0);
dictionary.Add("Red", 1);
dictionary.Add("Green", 2);
dictionary.Add("Blue", 3);
dictionary.Add("Yellow", 4);
dictionary.Add("Cyan", 5);
dictionary.Add("Magenta", 6);
<>f__switch$map1 = dictionary;
}
if (<>f__switch$map1.TryGetValue(key, out num))
{
switch (num)
{
case 0:
this.mWidget.color = Color.white;
break;
case 1:
this.mWidget.color = Color.red;
break;
case 2:
this.mWidget.color = Color.green;
break;
case 3:
this.mWidget.color = Color.blue;
break;
case 4:
this.mWidget.color = Color.yellow;
break;
case 5:
this.mWidget.color = Color.cyan;
break;
case 6:
this.mWidget.color = Color.magenta;
break;
}
}
}
}
}
示例13: Awake
private void Awake()
{
if (this.Widget == null)
{
this.Widget = this.GetComponent<UIWidget>();
}
}
示例14: Awake
/// <summary>
/// Find all needed components.
/// </summary>
void Awake ()
{
mWidget = GetComponentInChildren<UIWidget>();
Renderer ren = renderer;
if (ren != null) mMat = ren.material;
mLight = light;
}
示例15: fromXML
public static XmlNodeList fromXML(XmlNode nd, out UIWidget ui, UIWidget p)
{
ui = new UIStub();
ui.fromXML(nd);
ui.paresent = p;
return nd.ChildNodes;
}