void OnTransmission(object transmitter, UIPackage package) { SequencePlayer sequencePlayer = null; switch(package.eventType) { case UIEventTypes.Selected: sequencePlayer = OnSelected; break; case UIEventTypes.Deselected: sequencePlayer = OnDeselected; break; } if(sequencePlayer != null) { if(package.immediateStateChange) { sequencePlayer.SampleEnd(); } else { sequencePlayer.Play(); } } }
void OnTransmission(object transmitter, UIPackage package) { SequencePlayer sequencePlayer = null; if(package.eventType == UIEventTypes.Selected) { if(transmitter as RadioButton == this) { sequencePlayer = OnSelected; } else { sequencePlayer = OnDeselected; Relay.AddUITransmission(this, UIEventTypes.Deselected, Option); } if(package.immediateStateChange) { sequencePlayer.SampleEnd(); } else { sequencePlayer.Play(); } } }
public static SimpleMainWindow CreateInstance() { return((SimpleMainWindow)UIPackage.CreateObject("SimpleUI", "SimpleMainWindow")); }
public static void PreLoadAssetBundle(string path, string bundleName) { UIPackage.AddPackage(path.ToLower(), (string name, string extension, System.Type type) => { return(AssetLoadManager.LoadAsset(bundleName, name, type)); }); }
public static RoleSourceWindow CreateInstance() { return((RoleSourceWindow)UIPackage.CreateObject("SimpleUI", "RoleSourceWindow")); }
public static UI_AnimalAttributes CreateInstance() { return((UI_AnimalAttributes)UIPackage.CreateObject("Zoo", "AnimalAttributes")); }
public static UI_Settlement CreateInstance() { return((UI_Settlement)UIPackage.CreateObject("baijiale", "Settlement")); }
public static WindowA CreateInstance() { return((WindowA)UIPackage.CreateObject("Basics", "WindowA")); }
public static UI_FightStart CreateInstance() { return((UI_FightStart)UIPackage.CreateObject("Fight", "FightStart")); }
public bool SC_StoreData(Protomsg.MsgBase d1) { //Debug.Log("SC_NoticeWords:"); IMessage IMperson = new Protomsg.SC_StoreData(); Protomsg.SC_StoreData p1 = (Protomsg.SC_StoreData)IMperson.Descriptor.Parser.ParseFrom(d1.Datas); main.GetChild("n3").asList.RemoveChildren(); //排序 //处理排序 Protomsg.CommodityDataProto[] allplayer = new Protomsg.CommodityDataProto[p1.Commoditys.Count]; int index = 0; foreach (var item in p1.Commoditys) { allplayer[index++] = item; } System.Array.Sort(allplayer, (a, b) => { if (a.PriceType == b.PriceType) { if (a.Price > b.Price) { return(1); } else if (a.Price == b.Price) { return(0); } return(-1); } else if (a.PriceType > b.PriceType) { return(1); } else { return(-1); } }); foreach (var item in allplayer) { var clientitem = ExcelManager.Instance.GetItemManager().GetItemByID(item.ItemID); if (clientitem == null) { continue; } var onedropitem = UIPackage.CreateObject("GameUI", "Commodity").asCom; onedropitem.GetChild("n0").asLoader.url = clientitem.IconPath; onedropitem.GetChild("n3").asLoader.url = Tool.GetPriceTypeIcon(item.PriceType); onedropitem.GetChild("n0").onClick.Add(() => { new ItemInfo(item.ItemID); }); onedropitem.GetChild("n4").asTextField.text = item.Price + ""; onedropitem.GetChild("level").asTextField.text = "Lv." + item.Level + ""; onedropitem.GetChild("n1").asButton.onClick.Add(() => { //购买 Protomsg.CS_BuyCommodity msg1 = new Protomsg.CS_BuyCommodity(); msg1.TypeID = item.TypeID; MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_BuyCommodity", msg1); }); main.GetChild("n3").asList.AddChild(onedropitem); } return(true); }
public static Demo_Label CreateInstance() { return((Demo_Label)UIPackage.CreateObject("Basics", "Demo_Label")); }
public override void OnInspectorGUI() { serializedObject.Update(); #if UNITY_5 DrawPropertiesExcluding(serializedObject, propertyToExclude); #endif UIConfig config = (UIConfig)target; EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); itemsFoldout = EditorGUILayout.Foldout(itemsFoldout, "Config Items"); if (EditorGUI.EndChangeCheck()) { EditorPrefs.SetBool("itemsFoldOut", itemsFoldout); } EditorGUILayout.EndHorizontal(); if (itemsFoldout) { Undo.RecordObject(config, "Items"); int len = config.Items.Count; EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Add"); UIConfig.ConfigKey selectedKey = (UIConfig.ConfigKey)EditorGUILayout.EnumPopup((System.Enum)UIConfig.ConfigKey.PleaseSelect); if (selectedKey != UIConfig.ConfigKey.PleaseSelect) { int index = (int)selectedKey; if (index > len - 1) { for (int i = len; i < index; i++) { config.Items.Add(new UIConfig.ConfigValue()); } UIConfig.ConfigValue value = new UIConfig.ConfigValue(); value.valid = true; InitDefaultValue(selectedKey, value); config.Items.Add(value); } else { UIConfig.ConfigValue value = config.Items[index]; if (value == null) { value = new UIConfig.ConfigValue(); value.valid = true; InitDefaultValue(selectedKey, value); config.Items[index] = value; } else if (!value.valid) { value.valid = true; InitDefaultValue(selectedKey, value); } } } EditorGUILayout.EndHorizontal(); for (int i = 0; i < len; i++) { UIConfig.ConfigValue value = config.Items[i]; if (value == null || !value.valid) { continue; } EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(((UIConfig.ConfigKey)i).ToString()); switch ((UIConfig.ConfigKey)i) { case UIConfig.ConfigKey.ClickDragSensitivity: case UIConfig.ConfigKey.DefaultComboBoxVisibleItemCount: case UIConfig.ConfigKey.DefaultScrollStep: case UIConfig.ConfigKey.TouchDragSensitivity: case UIConfig.ConfigKey.TouchScrollSensitivity: case UIConfig.ConfigKey.InputCaretSize: value.i = EditorGUILayout.IntField(value.i); break; case UIConfig.ConfigKey.ButtonSound: case UIConfig.ConfigKey.GlobalModalWaiting: case UIConfig.ConfigKey.HorizontalScrollBar: case UIConfig.ConfigKey.LoaderErrorSign: case UIConfig.ConfigKey.PopupMenu: case UIConfig.ConfigKey.PopupMenu_seperator: case UIConfig.ConfigKey.TooltipsWin: case UIConfig.ConfigKey.VerticalScrollBar: case UIConfig.ConfigKey.WindowModalWaiting: case UIConfig.ConfigKey.DefaultFont: value.s = EditorGUILayout.TextField(value.s); break; case UIConfig.ConfigKey.DefaultScrollBounceEffect: case UIConfig.ConfigKey.DefaultScrollTouchEffect: case UIConfig.ConfigKey.RenderingTextBrighterOnDesktop: case UIConfig.ConfigKey.AllowSoftnessOnTopOrLeftSide: value.b = EditorGUILayout.Toggle(value.b); break; case UIConfig.ConfigKey.ButtonSoundVolumeScale: value.f = EditorGUILayout.Slider(value.f, 0, 1); break; case UIConfig.ConfigKey.ModalLayerColor: case UIConfig.ConfigKey.InputHighlightColor: value.c = EditorGUILayout.ColorField(value.c); break; } if (GUILayout.Button(new GUIContent("X", "Delete Item"), EditorStyles.miniButtonRight, GUILayout.Width(30))) { config.Items[i].Reset(); } EditorGUILayout.EndHorizontal(); } } EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); packagesFoldOut = EditorGUILayout.Foldout(packagesFoldOut, "Preload Packages"); if (EditorGUI.EndChangeCheck()) { EditorPrefs.SetBool("packagesFoldOut", packagesFoldOut); } EditorGUILayout.EndHorizontal(); if (packagesFoldOut) { Undo.RecordObject(config, "PreloadPackages"); EditorToolSet.LoadPackages(); if (EditorToolSet.packagesPopupContents != null) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Add"); int selected = EditorGUILayout.Popup(EditorToolSet.packagesPopupContents.Length - 1, EditorToolSet.packagesPopupContents); EditorGUILayout.EndHorizontal(); if (selected != EditorToolSet.packagesPopupContents.Length - 1) { UIPackage pkg = UIPackage.GetPackages()[selected]; string tmp = pkg.assetPath.ToLower(); int pos = tmp.LastIndexOf("resources/"); if (pos != -1) { string packagePath = pkg.assetPath.Substring(pos + 10); if (config.PreloadPackages.IndexOf(packagePath) == -1) { config.PreloadPackages.Add(packagePath); } errorState = 0; } else { errorState = 10; } } } if (errorState > 0) { errorState--; EditorGUILayout.HelpBox("Package is not in resources folder.", MessageType.Warning); } int cnt = config.PreloadPackages.Count; int pi = 0; while (pi < cnt) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("" + pi + "."); config.PreloadPackages[pi] = EditorGUILayout.TextField(config.PreloadPackages[pi]); if (GUILayout.Button(new GUIContent("X", "Delete Item"), EditorStyles.miniButtonRight, GUILayout.Width(30))) { config.PreloadPackages.RemoveAt(pi); cnt--; } else { pi++; } EditorGUILayout.EndHorizontal(); } } else { errorState = 0; } if (serializedObject.ApplyModifiedProperties()) { (target as UIConfig).ApplyModifiedProperties(); } }
void ToolManager() { Debug.Log("platform:" + Application.platform); mRoot.GetChild("gmset").visible = false; //if (Application.platform == RuntimePlatform.Android) if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor) { mRoot.GetChild("gmset").visible = true; mRoot.GetChild("gmset").asButton.onClick.Add(() => { //打开gm窗口 var gmtool = UIPackage.CreateObject("GameUI", "GMTool").asCom; GRoot.inst.AddChild(gmtool); gmtool.xy = Tool.GetPosition(0.5f, 0.5f); gmtool.GetChild("close").asButton.onClick.Add(() => { gmtool.Dispose(); }); //开服 gmtool.GetChild("opengame").asButton.onClick.Add(() => { Tool.NoticeWindonw("你确定要打开服务器吗?", () => { //获取服务器列表 StartCoroutine(Tool.SendGet(GameLauncherUrl + "/startgame", (WWW data) => { //data.text if (data.error != null) { Tool.NoticeWords("打开失败:" + data.error, null); return; } Tool.NoticeWords("开服服务器返回:" + data.text, null); })); }); }); //关服 gmtool.GetChild("closegame").asButton.onClick.Add(() => { Tool.NoticeWindonw("你确定要关闭服务器吗?", () => { //获取服务器列表 StartCoroutine(Tool.SendGet(GameLauncherUrl + "/endgame", (WWW data) => { //data.text if (data.error != null) { Tool.NoticeWords("关服失败:" + data.error, null); return; } Tool.NoticeWords("关服服务器返回:" + data.text, null); })); }); }); //刷新人数 gmtool.GetChild("freshplayercount").asButton.onClick.Add(() => { //获取服务器列表 StartCoroutine(Tool.SendGet("http://119.23.8.72:9999/sd", (WWW data) => { //data.text if (data.error != null) { Tool.NoticeWords("刷新人数失败:" + data.error, null); return; } gmtool.GetChild("playercount").asTextField.text = data.text; Tool.NoticeWords("刷新人数服务器返回:" + data.text, null); })); }); //修改公告 gmtool.GetChild("editnotice").asButton.onClick.Add(() => { var createguildwd = UIPackage.CreateObject("GameUI", "EditorGuildNotice").asCom; GRoot.inst.AddChild(createguildwd); createguildwd.xy = Tool.GetPosition(0.5f, 0.5f); createguildwd.GetChild("close").asButton.onClick.Add(() => { createguildwd.Dispose(); }); //默认文字 createguildwd.GetChild("input").asTextInput.text = GameNotice; createguildwd.GetChild("create").asButton.onClick.Add(() => { var txt = createguildwd.GetChild("input").asTextInput.text; if (txt.Length <= 0) { Tool.NoticeWords("请输入文字!", null); return; } Tool.NoticeWindonw("你确定修改公告吗?", () => { //创建 //获取服务器列表 StartCoroutine(Tool.SendGet(GameLauncherUrl + "/setnotice?txt=" + txt, (WWW data) => { //data.text if (data.error != null) { Tool.NoticeWords("修改公告失败:" + data.error, null); return; } gmtool.GetChild("playercount").asTextField.text = data.text; Tool.NoticeWords("修改公告服务器返回:" + data.text, null); })); createguildwd.Dispose(); }); }); }); }); } }
//显示选择英雄界面 public void showSelectHero() { SelectLayer = UIPackage.CreateObject("Package1", "SelectHero").asCom; GRoot.inst.AddChildAt(SelectLayer, 0); Vector2 screenPos = new Vector2(Screen.width / 2, Screen.height / 2); Vector2 logicScreenPos = GRoot.inst.GlobalToLocal(screenPos); SelectLayer.xy = logicScreenPos; //---设置默认选择英雄 if (SaveDataManager.sData.SelectHeroTypeID <= 0) { SaveDataManager.sData.SelectHeroTypeID = openherotypeids1[0]; } freshSelectHero(); SelectLayer.GetChild("startbtn").asButton.onClick.Add(() => { if (SelectHeroMsg.Name.Length <= 0) { //输入名字 var inputnamecom = UIPackage.CreateObject("Package1", "InputName").asCom; GRoot.inst.AddChild(inputnamecom); inputnamecom.xy = logicScreenPos; inputnamecom.GetChild("ok").asButton.onClick.Add(() => { var txt = inputnamecom.GetChild("input").asTextInput.text; if (txt.Length <= 0) { Tool.NoticeWords("请输入名字!", null); return; } if (Tool.IsChineseOrNumberOrWord(txt) == false) { Tool.NoticeWords("名字不含有中文,字母,数字以外的其他字符!", null); return; } SelectHeroMsg.Name = txt; Debug.Log("name:" + txt); Protomsg.CS_SelectCharacter msg1 = new Protomsg.CS_SelectCharacter(); msg1.SelectCharacter = SelectHeroMsg; MyKcp.Instance.SendMsg("Login", "CS_SelectCharacter", msg1); SelectHeroMsg.Name = ""; //清空名字 inputnamecom.Dispose(); }); inputnamecom.GetChild("input").asTextInput.onKeyDown.Add((EventContext context) => { if (context.inputEvent.keyCode == KeyCode.Return) { inputnamecom.GetChild("ok").asButton.onClick.Call(); } }); } else { Protomsg.CS_SelectCharacter msg1 = new Protomsg.CS_SelectCharacter(); msg1.SelectCharacter = SelectHeroMsg; MyKcp.Instance.SendMsg("Login", "CS_SelectCharacter", msg1); } }); }
//刷新选择英雄界面 public void freshSelectHero() { var herolist = SelectLayer.GetChild("heros_list").asList; herolist.RemoveChildren(); foreach (var item in AllOpenHeros) { var heroinfo = ExcelManager.Instance.GetUnitInfoManager().GetUnitInfoByID(item.Typeid); if (heroinfo == null) { Debug.Log("no hero:" + item.Name); continue; } var heroiconcom = UIPackage.CreateObject("Package1", "HeroIcon").asCom; //Debug.Log("------------hero:" + heroinfo.IconPath); heroiconcom.GetChild("pic").asLoader.url = heroinfo.IconPath; heroiconcom.GetChild("pic").asLoader.onClick.Add(() => { AudioManager.Am.Play2DSound(AudioManager.Sound_Click); //选择 SelectHero(item); }); heroiconcom.GetChild("level").asTextField.text = item.Level + ""; if (item.Typeid == SaveDataManager.sData.SelectHeroTypeID) { SelectHeroMsg = item; heroiconcom.GetChild("select").asImage.visible = true; //显示选择的英雄信息 SelectLayer.GetChild("selectheroicon").asCom.GetChild("pic").asLoader.url = heroinfo.IconPath; SelectLayer.GetChild("selectheroicon").asCom.GetChild("level").asTextField.text = item.Level + ""; SelectLayer.GetChild("heroname").asTextField.text = heroinfo.HeroName; SelectLayer.GetChild("player_name").asTextField.text = item.Name; //主属性(1:力量 2:敏捷 3:智力) if (heroinfo.AttributePrimary == 1) { SelectLayer.GetChild("type_attribute").asTextField.text = "力量"; } else if (heroinfo.AttributePrimary == 2) { SelectLayer.GetChild("type_attribute").asTextField.text = "敏捷"; } else if (heroinfo.AttributePrimary == 3) { SelectLayer.GetChild("type_attribute").asTextField.text = "智力"; } SelectLayer.GetChild("attack_range").asTextField.text = heroinfo.Attack_Range; SelectLayer.GetChild("des").asTextField.text = heroinfo.Des; //技能 var skillcom = SelectLayer.GetChild("skill_list").asList; skillcom.RemoveChildren(0, -1, true); var skills_str = heroinfo.Skills_ID.Split(','); foreach (var skilltype in skills_str) { var clientitem = ExcelManager.Instance.GetSkillManager().GetSkillByID(int.Parse(skilltype)); if (clientitem != null) { var onedropitem = UIPackage.CreateObject("GameUI", "HeroInfo_Skill").asButton; onedropitem.icon = clientitem.IconPath; onedropitem.GetChild("level").asTextField.text = ""; onedropitem.onClick.Add(() => { //Debug.Log("onClick"); if (clientitem.TypeID != -1) { new SkillInfo(clientitem.TypeID); } }); skillcom.AddChild(onedropitem); } } } else { heroiconcom.GetChild("select").asImage.visible = false; } herolist.AddChild(heroiconcom); } }
// Use this for initialization void Start() { Screen.fullScreen = false; m_LastQuickLoginTime = 0; SaveDataManager.SetFileName(winMachineid); //MyKcp.Instance.Destroy(); //读取存档 SaveDataManager.Read(); //UIPackage.AddPackage("FairyGui/GameUI"); //GComponent view = UIPackage.CreateObject("GameUI","MyInfo").asCom; //以下几种方式都可以将view显示出来: //1,直接加到GRoot显示出来 //GRoot.inst.AddChild(view); //view.Center(); Debug.Log("width:" + Screen.width + " height:" + Screen.height); UIPackage.AddPackage("FairyGui/GameUI"); //MyKcp.Instance.Create("119.23.8.72", 1118); //MyKcp.Instance.Create("119.23.8.72", 1118); mRoot = GetComponent <UIPanel>().ui; ToolManager(); //打开gm窗口 mLineUp = UIPackage.CreateObject("GameUI", "LineUp").asCom; GRoot.inst.AddChild(mLineUp); mLineUp.visible = false; mLineUp.xy = Tool.GetPosition(0.5f, 0.5f); mLineUp.GetChild("close").asButton.onClick.Add(() => { Tool.NoticeWindonw("你确定要退出排队吗?", () => { Protomsg.CS_CancelLineUp msg1 = new Protomsg.CS_CancelLineUp(); MyKcp.Instance.SendMsg("Login", "CS_CancelLineUp", msg1); mLineUp.visible = false; }); }); mLineUp.GetChild("fresh").asButton.onClick.Add(() => { Tool.NoticeWindonw("你确定要查看排在你前面的玩家人数吗?", () => { Protomsg.CS_GetLineUpFrontCount msg1 = new Protomsg.CS_GetLineUpFrontCount(); MyKcp.Instance.SendMsg("Login", "CS_GetLineUpFrontCount", msg1); }); }); //mRoot.GetChild("center")..AddChild(view); mRoot.GetChild("login").asButton.onClick.Add(() => { //两秒内不能重复登录 if (Tool.GetTime() - m_LastQuickLoginTime <= 2 || SelectServer == null) { return; } m_LastQuickLoginTime = Tool.GetTime(); //MyKcp.Instance.Destroy(); //MyKcp.Instance.Create(SelectServer.ip, SelectServer.port); MyKcp.Create(SelectServer.Ip, SelectServer.Port); Protomsg.CS_MsgQuickLogin msg1 = new Protomsg.CS_MsgQuickLogin(); //msg1.Machineid = "100001"; //PA //msg1.Machineid = "10000"; //剑圣 (技能特效完结) //msg1.Machineid = "10002"; //小黑 (技能特效完结) //msg1.Machineid = "10003"; //虚空 (技能特效完结) //msg1.Machineid = "10004"; //混沌骑士 (技能特效完结) //msg1.Machineid = "10005"; //熊战士 (技能特效完结) //msg1.Machineid = "10006"; //血魔 (技能特效完结) //msg1.Machineid = "10007"; //小娜迦 (技能特效完结) //msg1.Machineid = "10008"; //小小 (技能特效完结) //msg1.Machineid = "10009"; //风行 (技能特效完结) //msg1.Machineid = "10010"; //帕克 (技能特效完结) //msg1.Machineid = "10011"; //影魔 (技能特效完结) //msg1.Machineid = "10012"; //幽鬼 (技能特效完结) //msg1.Machineid = "10013"; //火枪 (技能特效完结) //msg1.Machineid = "10014"; //斧王 (技能特效完结) //msg1.Machineid = "10015"; //月骑 (技能特效完结) //msg1.Machineid = "10016"; //毒龙 (技能特效完结) //msg1.Machineid = "10017"; //蓝猫 (技能特效完结) //msg1.Machineid = "10018"; //瘟疫法师 //msg1.Machineid = "10019"; //天怒法师 Environment.GetCommandLineArgs(); msg1.Machineid = SystemInfo.deviceUniqueIdentifier + winMachineid; msg1.Platform = "test"; MyKcp.Instance.SendMsg("Login", "CS_MsgQuickLogin", msg1); UnityEngine.Debug.Log("login onClick"); }); InitServerList(); MsgManager.Instance.AddListener("SC_Logined", new HandleMsg(this.Logined)); MsgManager.Instance.AddListener("SC_SelectCharacterResult", new HandleMsg(this.SelectCharacterResult)); MsgManager.Instance.AddListener("SC_NeedLineUp", new HandleMsg(this.SC_NeedLineUp)); MsgManager.Instance.AddListener("SC_GetLineUpFrontCount", new HandleMsg(this.SC_GetLineUpFrontCount)); }
public static RolePanel CreateInstance() { return((RolePanel)UIPackage.CreateObject("Login", "RolePanel")); }
public static UI_SmallHeroCard CreateInstance() { return((UI_SmallHeroCard)UIPackage.CreateObject("Battle", "SmallHeroCard")); }
void __clickEmoji2(EventContext context) { GButton item = (GButton)context.data; _input2.ReplaceSelection(Char.ConvertFromUtf32(Convert.ToInt32(UIPackage.GetItemByURL(item.icon).name, 16))); }
void OnGUI() { if (itemStyle == null) { itemStyle = new GUIStyle(GUI.skin.GetStyle("IN Toggle")); itemStyle.normal.background = null; itemStyle.onNormal.background = GUI.skin.GetStyle("ObjectPickerResultsEven").active.background; itemStyle.focused.background = null; itemStyle.onFocused.background = null; itemStyle.hover.background = null; itemStyle.onHover.background = null; itemStyle.active.background = null; itemStyle.onActive.background = null; itemStyle.margin.top = 0; itemStyle.margin.bottom = 0; } EditorGUILayout.BeginHorizontal(); //package list start------ EditorGUILayout.BeginHorizontal(); GUILayout.Space(5); EditorGUILayout.BeginVertical(); GUILayout.Space(10); EditorGUILayout.LabelField("Packages", (GUIStyle)"OL Title", GUILayout.Width(300)); EditorGUILayout.BeginHorizontal(); GUILayout.Space(4); scrollPos1 = EditorGUILayout.BeginScrollView(scrollPos1, (GUIStyle)"CN Box", GUILayout.Height(300), GUILayout.Width(300)); EditorToolSet.LoadPackages(); List <UIPackage> pkgs = UIPackage.GetPackages(); int cnt = pkgs.Count; if (cnt == 0) { selectedPackage = -1; selectedPackageName = null; } else { for (int i = 0; i < cnt; i++) { EditorGUILayout.BeginHorizontal(); GUILayout.Space(4); if (GUILayout.Toggle(selectedPackageName == pkgs[i].name, pkgs[i].name, itemStyle, GUILayout.ExpandWidth(true))) { selectedPackage = i; selectedPackageName = pkgs[i].name; } EditorGUILayout.EndHorizontal(); } } EditorGUILayout.EndScrollView(); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); //package list end------ //component list start------ EditorGUILayout.BeginHorizontal(); GUILayout.Space(5); EditorGUILayout.BeginVertical(); GUILayout.Space(10); EditorGUILayout.LabelField("Components", (GUIStyle)"OL Title", GUILayout.Width(220)); EditorGUILayout.BeginHorizontal(); GUILayout.Space(4); scrollPos2 = EditorGUILayout.BeginScrollView(scrollPos2, (GUIStyle)"CN Box", GUILayout.Height(300), GUILayout.Width(220)); if (selectedPackage >= 0) { List <PackageItem> items = pkgs[selectedPackage].GetItems(); int i = 0; foreach (PackageItem pi in items) { if (pi.type == PackageItemType.Component && pi.exported) { EditorGUILayout.BeginHorizontal(); GUILayout.Space(4); if (GUILayout.Toggle(selectedComponentName == pi.name, pi.name, itemStyle, GUILayout.ExpandWidth(true))) { selectedComponentName = pi.name; } i++; EditorGUILayout.EndHorizontal(); } } } EditorGUILayout.EndScrollView(); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); //component list end------ GUILayout.Space(10); EditorGUILayout.EndHorizontal(); GUILayout.Space(20); //buttons start--- EditorGUILayout.BeginHorizontal(); GUILayout.Space(180); if (GUILayout.Button("Refresh", GUILayout.Width(100))) { EditorToolSet.ReloadPackages(); } GUILayout.Space(20); if (GUILayout.Button("OK", GUILayout.Width(100)) && selectedPackage >= 0) { UIPackage selectedPkg = pkgs[selectedPackage]; string tmp = selectedPkg.assetPath.ToLower(); string packagePath; int pos = tmp.LastIndexOf("resources/"); if (pos != -1) { packagePath = selectedPkg.assetPath.Substring(pos + 10); } else { packagePath = selectedPkg.assetPath; } bool isPrefab = PrefabUtility.GetPrefabType(Selection.activeGameObject) == PrefabType.Prefab; Selection.activeGameObject.SendMessage("OnUpdateSource", new object[] { selectedPkg.name, packagePath, selectedComponentName, !isPrefab }, SendMessageOptions.DontRequireReceiver); #if UNITY_5_3_OR_NEWER EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); #elif UNITY_5 EditorApplication.MarkSceneDirty(); #else EditorUtility.SetDirty(Selection.activeGameObject); #endif this.Close(); } EditorGUILayout.EndHorizontal(); }
public static UI_Window CreateInstance() { return((UI_Window)UIPackage.CreateObject("UI_CheckUpdate", "Window")); }
public static UI_BagButton CreateInstance() { return((UI_BagButton)UIPackage.CreateObject("main", "BagButton")); }
public static UI_List01 CreateInstance() { return((UI_List01)UIPackage.CreateObject("Zoo", "List01")); }
public static UI_HandCards CreateInstance() { return((UI_HandCards)UIPackage.CreateObject("Battle", "HandCards")); }
public static UI_Group CreateInstance() { return((UI_Group)UIPackage.CreateObject("Battle", "Group")); }
public static UI_AdventureSubItem CreateInstance() { return((UI_AdventureSubItem)UIPackage.CreateObject("Adventure", "AdventureSubItem")); }
public static UI_BuildingList CreateInstance() { return((UI_BuildingList)UIPackage.CreateObject("Main", "BuildingList")); }
public static Layout_0 CreateInstance() { return((Layout_0)UIPackage.CreateObject("Login", "Layout_0")); }
private static GObject CreateGObject() { return(UIPackage.CreateObject(UIPackageName, UIResName)); }
public void initUI() { UIObjectFactory.SetPackageItemExtension("ui://UIMain/MonsterCard", typeof(MonsterCardComponent)); UIObjectFactory.SetPackageItemExtension("ui://UIMain/TowerPanel", typeof(TowerPanel)); UIObjectFactory.SetPackageItemExtension("ui://UIMain/RolePanel", typeof(RolePanel)); UIObjectFactory.SetPackageItemExtension("ui://UIMain/MemoPanel", typeof(MemoPanel)); UIObjectFactory.SetPackageItemExtension("ui://UIMain/MemoWindow", typeof(MemoInternalWindow)); //UIObjectFactory.SetPackageItemExtension("ui://UIMain/MemoWindow", typeof(MemoInternalWindow)); UIObjectFactory.SetPackageItemExtension("ui://UIMain/BranchItem", typeof(SelectionBranch)); UIObjectFactory.SetPackageItemExtension("ui://UIMain/ComponentView", typeof(ComponentView)); UIObjectFactory.SetPackageItemExtension("ui://UIMain/TowerViewInList", typeof(GButton)); UIObjectFactory.SetPackageItemExtension("ui://UIMain/NewItem", typeof(NewItem)); UIObjectFactory.SetPackageItemExtension("ui://UIMain/EnterBattlePanel", typeof(EnterBattlePanel)); UIObjectFactory.SetPackageItemExtension("ui://UIMain/MemoItem", typeof(MemoItem)); UIObjectFactory.SetPackageItemExtension("ui://UIMain/PotionSmall", typeof(PotionSmall)); UIObjectFactory.SetPackageItemExtension("ui://UIMain/ScarSmall", typeof(ScarSmallIcon)); UIObjectFactory.SetPackageItemExtension("ui://UIMain/TowerPropertyDetail", typeof(TowerPropertyAfter)); UIObjectFactory.SetPackageItemExtension("ui://UIMain/TowerDamageItem", typeof(TowerDamageItem)); UIObjectFactory.SetPackageItemExtension("ui://UIMain/TowerSkillItem", typeof(TowerSkillItem)); UIObjectFactory.SetPackageItemExtension("ui://UIMain/AccesoryView", typeof(AccesoryView)); UIObjectFactory.SetPackageItemExtension("ui://UIMain/PropertyCompareLine", typeof(PropertyCompareLine)); UIObjectFactory.SetPackageItemExtension("ui://UIMain/PropertyModify", typeof(PropertyModify)); UIObjectFactory.SetPackageItemExtension("ui://UIMain/Hint", typeof(HintComponent)); //UIObjectFactory.SetPackageItemExtension("ui://UIMain/AccesoryView", typeof(AccesoryView)); _main = GameObject.Find("UIPanel").GetComponent <UIPanel> ().ui; initEncounterDetail(); monsterContianer = _main.GetChild("monsters").asCom; hpTextView = _main.GetChild("hp").asTextField; moneyTextView = _main.GetChild("money").asTextField; sanTextView = _main.GetChild("san").asTextField; levelTextView = _main.GetChild("level").asTextField; showdetailButton = _main.GetChild("detail_button").asGraph; //showdetailButton.url="detail"; showdetailButton.onClick.Add(delegate(EventContext context) { if (!GRoot.inst.touchable) { Debug.Log("不能点"); } eMenu.Show(); if (PlayerData.getInstance().guideStage == 12) { GuideManager.getInstance().showGuideTowerTab(); PlayerData.getInstance().guideStage = 13; } }); _enterBattle = _main.GetChild("enterBattle").asLoader; _enterBattle.onTouchEnd.Add(delegate() { if (PlayerData.getInstance().chasingEnemies.Count > 0) { clickEnterBattleButton(); } }); _mask = _main.GetChild("mask").asGraph; // for (int i = 0; i < 3; i++) { // addMonster ("9"); // } //detailPanel.TweenFade (0,2); sbManager = new SelectionBranchManager(); eMenu = new ExploreMenu(); popupWindow = UIPackage.CreateObject("UIMain", "PopupConfirmWindow").asCom; unlockThingWindow = new UnlockThingWindow(); shopPanel = new ShopInterface(); exploreFinishWindow = new ExploreFinishWindow(); enterBattlePanel = new EnterBattlePanel(); getItemManager = new GetItemManager(); itemDetailAmplifier = new ItemDetailAmplifier(); }
private static void CreateGObjectAsync(UIPackage.CreateObjectCallback result) { UIPackage.CreateObjectAsync(UIPackageName, UIResName, result); }
public static UI_Alert CreateInstance() { return((UI_Alert)UIPackage.CreateObject("baijiale", "Alert")); }
private UIPackage GetPackage() { if (package == null) { package = ServiceLocator.Resolve<UIPackage>(); } return package; }