本文整理汇总了C#中UISprite.GetComponent方法的典型用法代码示例。如果您正苦于以下问题:C# UISprite.GetComponent方法的具体用法?C# UISprite.GetComponent怎么用?C# UISprite.GetComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UISprite
的用法示例。
在下文中一共展示了UISprite.GetComponent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
// Use this for initialization
void Start () {
r_LoadingScreen = gameObject.GetComponent( typeof( UISprite ) ) as UISprite;
if( r_LoadingScreen == null ){
Debug.LogError("Unable to find LoadingScreen");
} else {
r_LoadingScreenTweener = r_LoadingScreen.GetComponent( typeof( UITweener) ) as UITweener;
r_LoadingScreen.alpha = 1.0f;
StartCoroutine("fadeIn");
}
r_LoadingMessage = r_LoadingScreen.GetComponentInChildren( typeof (UILabel) ) as UILabel;
if( r_LoadingMessage == null ){
Debug.LogError("Unable to find LoadingMessage label");
} else {
r_LoadingMessageTweener = r_LoadingMessage.GetComponent( typeof( UITweener ) ) as UITweener;
}
}
示例2: OnCreate
public override void OnCreate()
{
base.OnCreate();
m_dialogText = GetChildComponent<AocTypewriterEffect>("DialogText");
m_leftHeadSprite = GetChildComponent<UISprite>("LeftHead");
m_rightHeadSprite = GetChildComponent<UISprite>("RightHead");
m_dialogBoardSprite = GetChildComponent<UISprite>("DialogBoard");
m_dialogEffectPlayer = m_dialogBoardSprite.GetComponent<UIEffectPlayer>();
m_pointer = GameObject.Find("FTUEPointer");
m_pointerSprite = m_pointer.GetComponent<UISprite>();
m_pointer.SetActive(false);
m_gameAreaTrans = GameObject.Find("GameArea").transform;
m_clickLabel = GetChildComponent<UILabel>("ClickLabel");
m_dialogTrans = mUIObject.transform.FindChild("DialogBoard");
m_pressReceiver = m_dialogTrans.GetComponent<PressReceiver>();
for (int i=0; i<9; ++i)
{
m_pic[i] = GetChildComponent<UISprite>("Picture" + (i+1).ToString());
}
}
示例3: OnCreate
public override void OnCreate()
{
base.OnCreate();
m_dialogText = GetChildComponent<AocTypewriterEffect>("DialogText");
m_head1Sprite = GetChildComponent<UISprite>("LeftHead");
m_head2Sprite = GetChildComponent<UISprite>("RightHead");
m_dialogBoardSprite = GetChildComponent<UISprite>("DialogBoard");
m_dialogEffectPlayer = m_dialogBoardSprite.GetComponent<UIEffectPlayer>();
m_backPic = GetChildComponent<UISprite>("Background");
m_itemBoard = GetChildComponent<UISprite>("ItemBoard");
m_clickSprite = GetChildComponent<UISprite>("ClickSprite");
m_pressReceiver = m_dialogBoardSprite.transform.GetComponent<PressReceiver>();
AddChildComponentMouseClick("SkipBtn", delegate()
{
EndDialog();
});
//解析DialogEvent配置文件
string eventContent = ResourceManager.Singleton.LoadTextFile("DialogEvent");
//解析Dialog配置文件////////////////////////////////////////////////////////////////////////
StringReader sr = new StringReader(eventContent);
string line = sr.ReadLine();
while (line != null)
{
if (line.Contains("//"))
{
line = sr.ReadLine();
continue;
}
if (string.IsNullOrEmpty(line))
{
line = sr.ReadLine();
continue;
}
string[] values = line.Split(new string[] { "\t", " " }, System.StringSplitOptions.RemoveEmptyEntries);
if (values.Length > 0)
{
int curStageNum = System.Convert.ToInt32(values[0]);
DialogTriggerPos triggerPos = (DialogTriggerPos)System.Convert.ToInt32(values[1]);
DialogEvent data = new DialogEvent();
data.dialogGroupNum = System.Convert.ToInt32(values[2]);
data.need3Star = (values[2] == "Y");
data.backPic = values[3];
data.triggerPos = triggerPos;
m_dialogEventMap.Add(new KeyValuePair<int, DialogTriggerPos>(curStageNum, triggerPos), data); //添加对话数据
}
line = sr.ReadLine();
}
sr.Close();
string content = ResourceManager.Singleton.LoadTextFile("Dialog");
//解析Dialog配置文件////////////////////////////////////////////////////////////////////////
sr = new StringReader(content);
line = sr.ReadLine();
int curDialogGroupNum = -1;
List<DialogData> curDialogGroup = new List<DialogData>();
while (line != null)
{
if (line.Contains("//"))
{
line = sr.ReadLine();
continue;
}
if (string.IsNullOrEmpty(line))
{
line = sr.ReadLine();
continue;
}
string[] values = line.Split(new string[] { "\t", " " }, System.StringSplitOptions.RemoveEmptyEntries);
if (values.Length > 0)
{
int num = System.Convert.ToInt32(values[0]);
if(curDialogGroupNum == -1)
{
curDialogGroupNum = num;
m_dialogGroupMap.Add(curDialogGroupNum, curDialogGroup);
}
else if (num != curDialogGroupNum) //若数字变化了,新加一组对话
{
curDialogGroup = new List<DialogData>(); //重新创建一个对话组数据
curDialogGroupNum = num; //更改当前在编的对话组数字
m_dialogGroupMap.Add(curDialogGroupNum, curDialogGroup);
}
DialogData data = new DialogData();
data.activeLeftHead = (values[1] == "L");
data.headLeft = values[2];
data.headRight = values[3];
data.itemSprite = values[4];
data.speed = System.Convert.ToInt32(values[5]);
data.content = values[6];
data.content.Replace('_', ' '); //下划线替换成空格
curDialogGroup.Add(data); //添加对话数据
//.........这里部分代码省略.........