static void Main(string[] args) { GList<int> arr = new GList<int>(10); arr.Add(0); arr.Add(1); arr.Add(2); arr.Add(3); arr.Add(4); arr.Add(5); arr.Add(6); arr.Add(7); arr.Add(8); arr.Add(9); arr.Insert(10,2); arr.Insert(321,2); arr.Insert(321, 2); Console.WriteLine(arr); arr.Remove(arr.Lenght); // Extension(Length)!!! Console.WriteLine(arr); arr.Remove(arr.Lenght); arr.Remove(arr.Lenght); arr.Remove(arr.Lenght); arr.Remove(arr.Lenght); Console.WriteLine(arr.Lenght); Console.WriteLine(arr.Find(10)); Console.WriteLine(arr.IsContain(10)); Console.WriteLine(arr); Console.WriteLine(arr.Min()); Console.WriteLine(arr.Max()); }
// Use this for initialization void Start() { Application.targetFrameRate = 60; UIPackage.AddPackage("LoopList"); _mainView = this.GetComponent <UIPanel>().ui; _list = _mainView.GetChild("list").asList; _list.SetVirtualAndLoop(); _list.itemRenderer = RenderListItem; _list.numItems = 5; _list.scrollPane.onScroll.Add(DoSpecialEffect); DoSpecialEffect(); }
void Start() { Application.targetFrameRate = 60; Stage.inst.onKeyDown.Add(OnKeyDown); _mainView = this.GetComponent <UIPanel>().ui; _mainView.GetChild("n6").onClick.Add(() => { _list.AddSelection(500, true); }); _mainView.GetChild("n7").onClick.Add(() => { _list.scrollPane.ScrollTop(); }); _mainView.GetChild("n8").onClick.Add(() => { _list.scrollPane.ScrollBottom(); }); _list = _mainView.GetChild("mailList").asList; _list.SetVirtual(); _list.itemRenderer = RenderListItem; _list.numItems = 1000; }
protected override void OnShown() { m_minimizeBtn = contentPane.GetChild("minimize_btn").asButton; m_minimizeBtn.onClick.Set(OckMinimize); m_minimizeBtn.selected = FastConsole.options.openState == OpenState.Minimize; m_transparentBtn = contentPane.GetChild("transparent_btn").asButton; m_transparentBtn.onClick.Set(OckTransparent); m_transparentBtn.selected = FastConsole.options.transparent; m_touchBtn = contentPane.GetChild("touch_btn").asButton; m_touchBtn.onClick.Set(OckTouch); m_touchBtn.selected = FastConsole.options.touchEnable; m_singleShowBtn = contentPane.GetChild("single_btn").asButton; m_singleShowBtn.onClick.Set(OckDetail); m_singleShowBtn.selected = FastConsole.options.detailEnable; m_btnClose = contentPane.GetChild("title").asCom.GetChild("close_btn").asButton; m_btnClose.onClick.Set(Hide); // list color m_colorList = contentPane.GetChild("color_list").asList; m_colorList.RemoveChildrenToPool(); var colorItem = m_colorList.GetFromPool("").asCom; m_colorBtn = new GButton[m_maxColorCount]; for (int i = 0; i < m_maxColorCount; i++) { var index = (i + 1).ToString(); colorItem.GetChild("color_" + index).asImage.color = FastConsole.options.colors[i]; m_colorBtn[i] = colorItem.GetChild("color_btn_" + index).asButton; m_colorBtn[i].data = i; m_colorBtn[i].onClick.Set(OckColor); if (FastConsole.options.colorIndex == i) { m_colorBtn[i].selected = true; } else { m_colorBtn[i].selected = false; } } m_colorList.AddChild(colorItem); }
public override void ConstructFromXML(XML xml) { base.ConstructFromXML(xml); m_c1 = this.GetController("c1"); m_ui = (GImage)this.GetChild("ui"); m_background = (GImage)this.GetChild("background"); m_bagBtn = (UI_BagButton)this.GetChild("bagBtn"); m_n57 = (GImage)this.GetChild("n57"); m_n94 = (UI_JinHuaYeMianAnNiu)this.GetChild("n94"); m_n95 = (UI_JingJiYeMianAnNiu)this.GetChild("n95"); m_n97 = (UI_ShangDianYeMian)this.GetChild("n97"); m_n70 = (GGroup)this.GetChild("n70"); m_gold_table = (GImage)this.GetChild("gold_table"); m_gold_text = (GTextField)this.GetChild("gold_text"); m_gold = (GImage)this.GetChild("gold"); m_gold_show = (GGroup)this.GetChild("gold_show"); m_lv = (GImage)this.GetChild("lv"); m_n26 = (GTextField)this.GetChild("n26"); m_lv_show = (GGroup)this.GetChild("lv_show"); m_name_table = (GImage)this.GetChild("name_table"); m_name = (GTextField)this.GetChild("name"); m_name_show = (GGroup)this.GetChild("name_show"); m_diamond_table = (GImage)this.GetChild("diamond_table"); m_diamond = (GImage)this.GetChild("diamond"); m_diamond_text = (GTextField)this.GetChild("diamond_text"); m_diamond_show = (GGroup)this.GetChild("diamond_show"); m_n108 = (UI_SheZhi)this.GetChild("n108"); m_n88 = (UI_DuanZaoYeMianAnNiu)this.GetChild("n88"); m_n89 = (UI_JiNengYeMianAnNiu)this.GetChild("n89"); m_n90 = (UI_JiangLiYeMianAnNiu)this.GetChild("n90"); m_n91 = (UI_JunTuanYeMianAnNiu)this.GetChild("n91"); m_n92 = (UI_RenWuYeMianAnNiu)this.GetChild("n92"); m_button_scence = (GGroup)this.GetChild("button_scence"); m_n106 = (GImage)this.GetChild("n106"); m_hero = (GImage)this.GetChild("hero"); m_n111 = (GImage)this.GetChild("n111"); m_n115 = (UI_TanSuoShiJie)this.GetChild("n115"); m_n113 = (UI_TiaoZhanBOSS)this.GetChild("n113"); m_n116 = (UI_WuDaoDaHui)this.GetChild("n116"); m_enemy = (GImage)this.GetChild("enemy"); m_n117 = (UI_TongTianMoTa)this.GetChild("n117"); m_hero_headbar = (UI_HeadBar)this.GetChild("hero_headbar"); m_enemy_headbar = (UI_HeadBar)this.GetChild("enemy_headbar"); m_n114 = (GGroup)this.GetChild("n114"); m_mailList = (GList)this.GetChild("mailList"); }
public void GListEngine_InsertList_DuplicateIdException() { //Arrange: Seeds the Mocked Accessor's list of GLists and creates an expected GList SeedGListsWithAccountId(); GList gListIdDup = new GList() { Id = 3, ListName = "DuplicateIdList" }; //Act: Insert GList with duplicate Id using the GListEngine InsertList() method gListEngine.InsertList(gListIdDup); //Assert: Handled by the Expected Exception attribute }
public void GListAccessor_Insert() { //Arrange: Create a new GList to be inserted into the DB GList expected = new GList { ListName = "Inserted List", Date = DateTime.Parse("2020-09-29"), AccountId = 1 }; //Act: Insert the GList into the DB using the GListAccessor Insert() method var result = gListAccessor.Insert(expected); gListAccessor.Delete(result.Id); //Assert: Checks that the expected GList was inserted correctly by comparing the expected and result GLists Assert.AreEqual(expected, result, "The grocery list was inserted incorrectly"); }
public void Init() { ui = GetComponent <UIPanel>().ui; storeup = ui.GetChild("n5").asCom; choice = storeup.GetChild("n12").asImage; baglist = storeup.GetChild("rightlist").asList; choice.visible = false; //leftlist = ui.GetChild("n2").asList; baglist.itemRenderer = RenderListItem; baglist.onClickItem.Add(onclick); //baglist.numItems = 24; //close(); leftright = 0; choiceindex = 0; lieshuxianding(); // OnBuy(0); }
public ScrollPaneScene() { UIPackage.AddPackage("UI/ScrollPane"); _mainView = UIPackage.CreateObject("ScrollPane", "Main").asCom; _mainView.MakeFullScreen(); _mainView.AddRelation(GRoot.inst, RelationType.Size); AddChild(_mainView); _list = _mainView.GetChild("list").asList; _list.itemRenderer = RenderListItem; _list.SetVirtual(); _list.numItems = 1000; _list.onTouchBegin.Add(OnClickList); _mainView.GetChild("box").asCom.onDrop.Add(OnDrop); }
private void FindObject() { userModel = ModelManager.inst.userModel; showMyUID = this.GetChild("n120").asTextField; showMyUID.text = Tools.GetMessageById("19972", new string[] { userModel.uid }); input = this.GetChild("n2").asCom.GetChild("n1").asTextInput; input.promptText = Tools.GetMessageById("19953"); btn = this.GetChild("n3").asButton; btn.text = Tools.GetMessageById("19945"); btn.RemoveEventListeners(); btn.onClick.Add(FindFriends); list = this.GetChild("n1").asList; list.emptyStr = Tools.GetMessageById("19933"); list.itemRenderer = SearchRender; list.SetVirtual(); }
protected override void OnInit() { this.contentPane = UIPackage.CreateObject("UIMain", "GetNewItem").asCom; this.Center(); this.modal = true; _new_item_list = this.contentPane.GetChild("list").asList; _new_item_list.EnsureBoundsCorrect(); _confirm = this.contentPane.GetChild("confirm").asButton; _confirm.onClick.Add(chooseItem); _confirm.visible = false; _skip = this.contentPane.GetChild("skip").asRichTextField; _skip.onTouchBegin.Add(skip); }
public override void ConstructFromXML(XML xml) { base.ConstructFromXML(xml); m_closeBtn = (GButton)this.GetChild("closeBtn"); m_ludanList = (GList)this.GetChild("ludanList"); m_zText = (GTextField)this.GetChild("zText"); m_xText = (GTextField)this.GetChild("xText"); m_pText = (GTextField)this.GetChild("pText"); InitClose(); m_ludanList.itemRenderer = RendererLudanList; m_ludanList.SetVirtual(); m_ludanList.numItems = 0; }
private bool getGoods(Goods goods) { GList goodsList = goods.type == "bullet" ? mulGoodsList : sinGoodsList; GObject[] goodsButton = goodsList.GetChildren(); foreach (GObject obj in goodsButton) { GButton button = (GButton)obj; string goodsUrl = goods.icon; if (!goods.icon.StartsWith("ui")) { goodsUrl = UIPackage.GetItemURL("BattleCity8102", "goods-" + goods.icon); } if (button.icon == goodsUrl) { int count = int.Parse(button.GetChild("countTextField").asTextField.text); count += goods.count; button.GetChild("countTextField").asTextField.text = count + ""; return(true); } } GButton btn = chooseEmptyIndex(goods); if (btn == null) { Debug.Log("背包满"); // 播放提示动效 playAlert("背包已满"); return(false); } btn.visible = true; btn.title = goods.type; // 判断icon是否为具体路径 string url = goods.icon; if (!url.StartsWith("ui")) { url = UIPackage.GetItemURL("BattleCity8102", "goods-" + goods.icon); } btn.icon = url; btn.GetChild("descriptionTextField").asTextField.text = goods.description; btn.GetChild("countTextField").asTextField.text = goods.count + ""; btn.GetChild("nameTextField").asTextField.text = goods.goodsName; btn.GetChild("coldDownTextField").asTextField.text = goods.coldDownTime + ""; return(true); }
void Start() { Application.targetFrameRate = 60; Stage.inst.onKeyDown.Add(OnKeyDown); _messages = new List <Message>(); _mainView = this.GetComponent <UIPanel>().ui; _list = _mainView.GetChild("list").asList; _list.SetVirtual(); _list.itemProvider = GetListItemResource; _list.itemRenderer = RenderListItem; _input1 = _mainView.GetChild("input1").asTextInput; _input1.onKeyDown.Add(__inputKeyDown1); _input2 = _mainView.GetChild("input2").asTextInput; _input2.onKeyDown.Add(__inputKeyDown2); //作为demo,这里只添加了部分表情素材 _emojies = new Dictionary <uint, Emoji>(); for (uint i = 0x1f600; i < 0x1f637; i++) { string url = UIPackage.GetItemURL("Emoji", Convert.ToString(i, 16)); if (url != null) { _emojies.Add(i, new Emoji(url)); } } _input2.emojies = _emojies; _mainView.GetChild("btnSend1").onClick.Add(__clickSendBtn1); _mainView.GetChild("btnSend2").onClick.Add(__clickSendBtn2); _mainView.GetChild("btnEmoji1").onClick.Add(__clickEmojiBtn1); _mainView.GetChild("btnEmoji2").onClick.Add(__clickEmojiBtn2); _emojiSelectUI1 = UIPackage.CreateObject("Emoji", "EmojiSelectUI").asCom; _emojiSelectUI1.fairyBatching = true; _emojiSelectUI1.GetChild("list").asList.onClickItem.Add(__clickEmoji1); _emojiSelectUI2 = UIPackage.CreateObject("Emoji", "EmojiSelectUI_ios").asCom; _emojiSelectUI2.fairyBatching = true; _emojiSelectUI2.GetChild("list").asList.onClickItem.Add(__clickEmoji2); }
public void GListEngine_GetList() { //Arrange: Seeds the Mocked Accessor's list of GLists and creates the expected list SeedGLists(); var expected = new GList { Id = 2, ListName = "Wednesday Groceries" }; //Act: Calls the GListEngine GetList() method with the id for the "Wednesday Groceries" list var result = gListEngine.GetList(2); //Assert: Checks whether expected and result GList are the same Assert.AreEqual(expected, result, $"GList {result.Id} was returned. GList {expected.Id} was expected."); }
public override void ConstructFromXML(FairyGUI.Utils.XML cxml) { base.ConstructFromXML(cxml); _name = this.GetChild("name").asTextField; _cost_panel = this.GetChild("cost").asCom; _cost1 = _cost_panel.GetChild("cost1").asTextField; _cost2 = _cost_panel.GetChild("cost2").asTextField; _cost3 = _cost_panel.GetChild("cost3").asTextField; _hit = this.GetChild("hit").asTextField; _range = this.GetChild("range").asTextField; _spd = this.GetChild("spd").asTextField; _damage_list = this.GetChild("damage").asList; _skill_list = this.GetChild("skills").asList; }
protected override void OnInit() { base.OnInit(); this.contentPane = UIPackage.CreateObject("LinkGame", "LinkWin").asCom; this.Center(); LinkList = this.contentPane.GetChild("list").asList; LinkList.itemRenderer = RenderListItem; LinkList.numItems = 40; //必须是能被20整除的数字,才会使得游戏逻辑没漏洞 LinkList.onClickItem.Add(OnLinkListClicked); scoreText = this.contentPane.GetChild("score_txt").asTextField; currentScore = 0; scoreText.SetVar("score", currentScore.ToString()).FlushVars(); this.AddEventListener(EventCmd.ScoreOne, PlusScore); }
public override void ConstructFromXML(FairyGUI.Utils.XML xml) { base.ConstructFromXML(xml); _hit = this.GetChild("hit").asTextField; _range = this.GetChild("range").asTextField; _spd = this.GetChild("spd").asTextField; _tname = this.GetChild("tname").asTextField; _damage_list = this.GetChild("damage").asList; _skill_list = this.GetChild("skills").asList; this.onTouchBegin.Add(delegate() { //GameManager.getInstance().showDetailAmplifier("减少生命上限"); }); }
public override void OnAwake() { mList = mWindowObj.GetChild("itemList").asList; mList.itemRenderer = RenderListItem; mBtnBack = mWindowObj.GetChild("n1").asButton; mBtnBack.onClick.Add(OnClickBack); int index = 0; for (int i = 4; i < 7; i++) { GComponent com = mWindowObj.GetChild("n" + i.ToString()).asCom; mTextTop[index] = com.GetChild("title").asTextField; index++; mTextTop[index] = com.GetChild("value").asTextField; index++; } }
//start void Start() { mRootUI = GetComponent <UIPanel>().ui; mQuestionDescrib = mRootUI.GetChild("QuestionDescribPanel").asCom; mAnswerAreaPanel = mRootUI.GetChild("AnswerAreaPanel").asCom; mAnswerAreaControll = mAnswerAreaPanel.GetController("QuestypeControll"); mHeadIconLoad = mRootUI.GetChild("user_icon").asLoader; //头像右侧个人空间 GList mHeadCenterlist = mRootUI.GetChild("userinfol_ist").asList; mHeadCenterlist.RemoveChildren(); for (int i = 0; i < 5; i++) { GButton mHeadCenterListItem = mHeadCenterlist.AddItemFromPool().asButton; mHeadCenterListItem.text = "个人空间"; } mHeadCenterlist.onClickItem.Add(OnHeadCenterListClick); //题目列表list GList mQuestionList = mRootUI.GetChild("id_list").asList; mQuestionList.RemoveChildren(); for (int j = 0; j < mListQuestion.Count; j++) { GButton mQuestionListItem = mQuestionList.AddItemFromPool().asButton; mListQuestion[j].questionState = mQuestionListItem.GetController("btncolor"); mQuestionListItem.text = j.ToString(); } mQuestionList.onClickItem.Add(OnQuestionListItemClick); //按钮初始化 mRootUI.GetChild("save_btn").asButton.onClick.Add(OnSaveBtnClick); mRootUI.GetChild("submit_btn").asButton.onClick.Add(OnSubmitBtnClick); mRootUI.GetChild("zoombtn").asButton.onClick.Add(OnZoomingBtnClick); mRootUI.GetChild("closebtn").asButton.onClick.Add(OnCloseBtnClick); //倒计时标志开始初始化 mCountDownText = mRootUI.GetChild("timerlimit").asTextField; mHasStartCountDown = true; }
public void GListEngine_InsertList_DuplicateNameException() { //Arrange: Seeds the Mocked Accessor's list of GLists and creates an expected GList with a duplcate name for an account SeedGListsWithAccountId(); GList gListNameDup = new GList() { Id = 6, ListName = "Another Joe List", AccountId = 3 }; //Act: Insert GList with duplicate name using the GListEngine InsertList() method gListEngine.InsertList(gListNameDup); //Assert: Handled by the Expected Exception attribute }
void Start() { _mainView = this.GetComponent <UIPanel>().ui; _list = _mainView.GetChild("list").asList; _list.itemRenderer = RenderListItem; _list.SetVirtual(); _list.numItems = 1000; _list.onTouchBegin.Add(OnClickList); _mainView.GetChild("box").asCom.onDrop.Add(OnDrop); LongPressGesture gesture = new LongPressGesture(_list); gesture.once = true; gesture.trigger = 1f; gesture.onAction.Add(OnLongPress); }
private void button3_Click(object sender, EventArgs e) { GList g = Class3.StrToMyList(textBox2.Text); int k = Convert.ToInt32(textBox1.Text); if (g.FindNode(k)) { g.Delete(k); if (saveFileDialog1.ShowDialog() == DialogResult.OK) { Class3.WriteToFileAll(saveFileDialog1.FileName, Class3.MyListToStr(g)); } } else { MessageBox.Show("Такого элемента нет в списке"); } }
public LoopListScene() { UIPackage.AddPackage("UI/LoopList"); _mainView = UIPackage.CreateObject("LoopList", "Main").asCom; _mainView.MakeFullScreen(); _mainView.AddRelation(GRoot.inst, RelationType.Size); AddChild(_mainView); _list = _mainView.GetChild("list").asList; _list.SetVirtualAndLoop(); _list.itemRenderer = RenderListItem; _list.numItems = 5; _list.scrollPane.onScroll.Add(DoSpecialEffect); DoSpecialEffect(); }
protected override void OnInit() { this.contentPane = UIPackage.CreateObject("UIMain", "ShopInterface").asCom; this.Center(); this.modal = true; _components = this.contentPane.GetChild("components").asList; _potions = this.contentPane.GetChild("potions").asList; _remove_scar = this.contentPane.GetChild("remove_scar").asGraph; _remove_scar.onClick.Add(delegate() { }); close = this.contentPane.GetChild("close").asLoader; close.onClick.Add(delegate(EventContext context) { this.Hide(); }); }
public override void Init() { base.Init(); this.Create(Config.VIEW_CUSTOM, false, Tools.GetMessageById("21008")); userModel = ModelManager.inst.userModel; tt = this.GetChild("n5").asTextInput; //tt.maxLength = 40; tt.promptText = Tools.GetMessageById("21014"); tt.onChanged.Add(() => { tt.text = Tools.GetStringByLength(tt.text, 40); tt.text = Tools.StrReplace(tt.text); }); GButton btn = this.GetChild("n4").asButton; btn.text = Tools.GetMessageById("13064"); btn.onClick.Add(OnClickBtn); NetHttp.inst.Send(NetBase.HTTP_GET_BUG_MSG, "", GetMsg); list = this.GetChild("n1").asList; list.SetVirtual(); list.itemRenderer = OnRander; language = (object[])DataManager.inst.systemSimple["language"]; List <object[]> arr = new List <object[]>(); foreach (object[] v in language) { arr.Add(v); } if (PlatForm.inst.language != "") { foreach (object[] v in arr) { if (v [0].ToString().Equals(PlatForm.inst.language)) { kefuName = v [2].ToString(); } } } }
protected override void OnInit() { this.contentPane = UIPackage.CreateObject("BattleCity8102", "TankList_Window").asCom; GComponent frameComponent = contentPane.GetChild("frame").asCom; //渲染TankList tankList = frameComponent.GetChild("tankList").asList; tankList.SetVirtual(); tankList.itemRenderer = RenderListItem; tankList.numItems = tankNum; //添加滚动特效 tankList.scrollPane.onScroll.Add(DoSpecialEffect); DoSpecialEffect(); //加入房间 contentPane.GetChild("frame").asCom.GetChild("tickButton").onClick.Add(() => { contentPane.Dispose(); new RoomWindow().Show(); }); }
protected override void StartFUI() { this.m_tank = this.FUIComponent.Get("n18").GObject.asButton; this.m_bullet = this.FUIComponent.Get("n19").GObject.asButton; this.m_prop = this.FUIComponent.Get("n20").GObject.asButton; this.m_closeBtn = this.FUIComponent.Get("n16").GObject.asButton; this.m_gold = this.FUIComponent.Get("n10").GObject.asTextField; this.m_itemList = this.FUIComponent.Get("n15").GObject.asList; this.m_controller = this.FUIComponent.GObject.asCom.GetController("c1"); this.m_infoTip = this.FUIComponent.Get("InfoTip").GObject.asCom; this.m_closeBtn.onClick.Set(this.OnClose); this.m_controller.onChanged.Set(this.CtlChange); this.UI(); }
public static void RunTest(bool isRun) { if (!isRun) { return; } GList <int> tempList = new GList <int> (); for (int i = 0; i < 10; i++) { GListNode <int> tempNode = new GListNode <int> (i + 10); tempList.AddLast(tempNode); } GList <int> .Reverse(tempList); Console.WriteLine("tempList = {0}", String.Join(", ", tempList)); }
public static GList <T> Reverse(GList <T> list) { GListNode <T> pre = null; GListNode <T> iter = list.first; GListNode <T> temp = null; //注意:先赋值last list.last = list.first; while (iter != null) { temp = iter.Next; iter.Next = pre; pre = iter; iter = temp; } //注意:反转完成后赋值first list.first = pre; return(list); }
public override void Init() { base.Init(); this.Create(Config.VIEW_GUILDINLIST); // view.GetChild ("n2").asTextField.text = Tools.GetMessageById ("31072"); // view.GetChild ("n3").asTextField.text = Tools.GetMessageById ("20125"); // view.GetChild ("n4").asTextField.text = Tools.GetMessageById ("20126"); this.GetChild("n6").asButton.text = Tools.GetMessageById("19926"); this.GetChild("n7").asButton.text = Tools.GetMessageById("19927"); list = this.GetChild("n0").asList; list.itemRenderer = ListRander; list.SetVirtual(); c1 = this.GetController("c1"); c1.onChanged.Add(OnChangeC1); this.visible = false; c1.selectedIndex = 1; // NetHttp.inst.Send (NetBase.HTTP_GUILD_RANK, "", GetGuildIndex); }
static void Main(string[] args) { GList<int> list = new GList<int>(5); list.Add(200); list.Add(2); list.Add(5); list.Add(8); list.Add(10); list.Insert(4, 100); list.Remove(200); Console.WriteLine(list.Min()); Console.WriteLine(list.Max()); Console.WriteLine(list); foreach (var item in list) { Console.WriteLine(item); } }