本文整理汇总了C#中Rect.Move方法的典型用法代码示例。如果您正苦于以下问题:C# Rect.Move方法的具体用法?C# Rect.Move怎么用?C# Rect.Move使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rect
的用法示例。
在下文中一共展示了Rect.Move方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnSetSelectGUI
public void OnSetSelectGUI() {
#if !UNITY_WEBPLAYER
GUIF.Button(new Rect(Screen.width * 0.01f, Screen.height * 0.01f, Screen.width * 0.4f, Screen.height * 0.075f), "Quit", () => {
#if UNITY_EDITOR
EditorApplication.isPlaying = false;
#else
Application.Quit();
#endif
});
#endif
Rect scrollArea = new Rect(Screen.width * 0.01f, Screen.height * 0.1f, Screen.width * 0.98f, Screen.height * 0.85f);
float lineHeight = GUI.skin.button.LineSize() * 1.33f;
Rect brush = new Rect(0.0f, 0.0f, scrollArea.width - 24, lineHeight);
scrollPos = GUI.BeginScrollView(scrollArea, scrollPos, new Rect(0, 0, Screen.width * 0.9f - 24, lineHeight * 1.05f * soundSets.Count)); {
brush.y = (int)(scrollPos.y / (brush.height * 1.05f)) * (brush.height * 1.05f);
for(int i = (int)Mathf.Max(scrollPos.y / (brush.height * 1.05f), 0); scrollPos.y >= ((i - 1) * brush.height * 1.05f) - scrollArea.height && i < soundSets.Count; i++) {
string set = soundSets[i];
GUIF.Button(brush, set, () => {
if(!scrolling) {
//currentSet = (Transform.Instantiate(Resources.Load<Transform>(set) as Transform) as Transform).GetComponent<SoundSetGO>();
Application.LoadLevel(set);
menuState = MenuState.ListingPhrases;
scrollPos = new Vector2();
scrollFling = 0;
searchString = "";
previousSearchString = "";
}
});
brush = brush.Move(0.0f, 1.05f);
}
} GUI.EndScrollView();
GUI.Label(new Rect(Screen.width * 0.05f, Screen.height * 0.95f, Screen.width * 0.9f, lineHeight), "Made by 005");
}
示例2: OnPhraseSelectGUI
public void OnPhraseSelectGUI() {
GUIF.Button(new Rect(Screen.width * 0.01f, Screen.height * 0.01f, Screen.width * 0.4f, Screen.height * 0.075f), "Back", () => {
Application.LoadLevel("default");
menuState = MenuState.ListingSets;
searchString = "";
scrollPos = new Vector2();
scrollFling = 0.0f;
});
string str;
switch(mode) {
case PlayMode.AlwaysInstant:
str = "Always Play";
break;
case PlayMode.Override:
str = "Override Playing";
break;
case PlayMode.Queue:
str = "Queue";
break;
case PlayMode.Spam:
str = "Spam";
break;
default:
str = "Error";
break;
}
GUIF.Button(new Rect(Screen.width * 0.59f, Screen.height * 0.01f, Screen.width * 0.4f, Screen.height * 0.075f), str, () => {
NextMode();
});
Rect scrollArea = new Rect(Screen.width * 0.01f, Screen.height * 0.2f, Screen.width * 0.98f, Screen.height * 0.73f);
float lineHeight = GUI.skin.button.LineSize() * 1.33f;
Rect brush = new Rect(Screen.width * 0.01f, Screen.height * 0.1f, Screen.width * 0.93f, lineHeight);
GUI.Label(brush.Left(0.2f), "Search");
searchString = GUI.TextField(brush.Right(0.8f), searchString);
GUIF.Button(new Rect(Screen.width * 0.94f, Screen.height * 0.1f, Screen.width * 0.05f, lineHeight), "X", () => {
searchString = "";
});
brush = brush.Move(0.0f, 1.0f);
brush.width = Screen.width * 0.98f;
switch(sortMode) {
case SortMode.Alphabetic:
str = "Alphabetic";
break;
case SortMode.MostPlayed:
str = "Most Played";
break;
case SortMode.SearchRelevance:
str = "Relevance";
break;
default:
str = "Error";
break;
}
GUIF.Button(brush, "Sort by: " + str, () => {
NextSortMode();
scrollPos = new Vector2();
scrollFling = 0.0f;
if(System.String.IsNullOrEmpty(SoundSet.Searchify(searchString))) {
currentSet.Sort();
} else {
searchResults.Sort((Phrase phrase1, Phrase phrase2) => {
if(sortMode == SortMode.Alphabetic) {
return phrase1.name.ToUpper().CompareTo(phrase2.name.ToUpper());
} else if(sortMode == SortMode.MostPlayed) {
return phrase2.timesPlayed - phrase1.timesPlayed;
} else if(sortMode == SortMode.SearchRelevance) {
return SoundSet.ComparePhrasesBySearchRelevance(phrase1.name.ToUpper(), phrase2.name.ToUpper(), SoundSet.Searchify(searchString));
} else {
return 0;
}
});
}
});
brush = new Rect(0.0f, 0.0f, scrollArea.width - 24, lineHeight);
System.Func<Rect, string, System.Action, bool> buttonFunc;
if(mode == PlayMode.Spam) {
buttonFunc = GUIF.RepeatButton;
} else {
buttonFunc = GUIF.Button;
}
if(!System.String.IsNullOrEmpty(SoundSet.Searchify(searchString))) {
scrollPos = GUI.BeginScrollView(scrollArea, scrollPos, new Rect(0, 0, Screen.width * 0.9f - 24, lineHeight * 1.05f * searchResults.Count)); {
brush.y = (int)(scrollPos.y / (brush.height * 1.05f)) * (brush.height * 1.05f);
for(int i = (int)Mathf.Max(scrollPos.y / (brush.height * 1.05f), 0); scrollPos.y >= ((i - 1) * brush.height * 1.05f) - scrollArea.height && i < searchResults.Count; i++) {
Phrase phrase = searchResults[i];
str = phrase.name;
if(phrase.clips.Count > 1) {
str += " (" + phrase.clips.Count + ")";
}
buttonFunc(brush, str, () => {
if(!scrolling) {
switch(mode) {
case PlayMode.Queue:
clipQueue.Enqueue(phrase.clips.Choose<AudioClip>());
break;
case PlayMode.AlwaysInstant:
case PlayMode.Spam:
PlaySound(phrase.clips.Choose<AudioClip>());
break;
case PlayMode.Override:
//.........这里部分代码省略.........
示例3: OnGUI
void OnGUI() {
GUI.skin = skin;
GUI.depth = depth;
Color c = sets.color;
c.a = time / sets.fadeTime;
GUI.color = c;
GUIStyle style = GUI.skin.label.FontSize(fontSize);
Vector2 size = style.CalcSize(new GUIContent(message));
//Vector2 size = new Vector2(1, 1);
//size.x += GUI.skin.box.padding.left + GUI.skin.box.padding.right + 2;
//size.y += GUI.skin.box.padding.top + GUI.skin.box.padding.bottom + 2;
//position -= size * .5f;
//Debug.Log(size);
/*
size.x /= Screen.width;
size.y /= Screen.height;
Rect area = new Rect(position.x, position.y, size.x, size.y);
area.x -= size.x *.5f;
area.y -= size.y *.5f;
msg.Draw(area);
//*/
//*
Rect area = new Rect(position.x * Screen.width, position.y * Screen.height, size.x, size.y);
area = area.Pad(4.0f);
area = area.Move(-.5f, -.5f);
if (outlined) {
GUIF.Label(area, message, style);
} else {
GUI.Label(area, message, style);
}
//*/
}