//can be triggered regardless of down void BallExit(ComplexButton btn) { if (m_Ball.isDead()) { return; // TODO future - optimize. I dont like that I invoke it everywhere } m_BallEnter = false; }
//can be triggered regardless of down void BallEnter(ComplexButton btn) // mobile enter? { if (m_Ball.isDead()) { return; // TODO future - optimize. I dont like that I invoke it everywhere } m_BallEnter = true; }
void OnClick(ComplexButton cbtn) { // TODO future - play sound if (m_OnBtnClickClbck != null) { m_OnBtnClickClbck(this); } }
/// <summary> /// 生成微信自定义菜单 /// </summary> /// <returns></returns> public JsonResult BuildWeChatMenu() { try { ComplexButton complexBtn; WXDefineMenu wxDefiMenu = new WXDefineMenu(); wxDefiMenu.button = new List <Button>(); List <DefineMenu> Menus = ServiceIoc.Get <DefineMenuService>().GetEnableList(); List <DefineMenu> mainMenus = Menus.Where(m => m.parent_id == 0).ToList(); if (mainMenus.Count > 0) { foreach (var menu in mainMenus) { var subMenus = Menus.Where(m => m.parent_id == menu.id).ToList(); if (subMenus.Count > 0) { complexBtn = new ComplexButton(); complexBtn.sub_button = new List <Button>(); complexBtn.name = menu.name; foreach (var submenu in subMenus) { complexBtn.sub_button.Add(GetButton(submenu)); } wxDefiMenu.button.Add(complexBtn); } else { wxDefiMenu.button.Add(GetButton(menu)); } } string postData = JsonConvert.SerializeObject(wxDefiMenu).Replace("%26", "&"); WeChatAccount wxAccount = ServiceIoc.Get <WeChatAccountService>().Get(); AccessToken token = WeChatBaseHelper.GetAccessToken(wxAccount.appid, wxAccount.app_secret); if (token.access_token == null) { return(Json(GetResult(StateCode.State_152, token.errcode))); } string data = WeChatBaseHelper.CreateWXMenu(token.access_token, postData); var errcode = JsonConvert.DeserializeObject <WXErrCode>(data); if (errcode.errcode > 0) { return(Json(GetResult(StateCode.State_152, token.errcode))); } } return(Json(GetResult(StateCode.State_200))); } catch { return(Json(GetResult(StateCode.State_500))); } }
// triggered when inside the ball void BallDown(ComplexButton btn) { if (m_Ball.isDead()) { return; // TODO future - optimize. I dont like that I invoke it everywhere } // Debug.LogError("Ball down"); m_BallDown = true; m_BallUp = false; m_Ball.m_LineHelper.Show(true); m_Ball.m_FingerHelper.Show(true); }
// triggered regardless of pointer position (inside/outside of the ball) // BUT, triggers only after BallDown void BallUp(ComplexButton btn) { if (m_Ball.isDead() || !m_BallDown) { return; // TODO future - optimize. I dont like that I invoke it everywhere } // Debug.Log(" m_BallDown " + m_BallDown); m_BallDown = false; m_BallUp = true; // Debug.LogError("Ball up"); TryToLaunchOrCancelBall(); m_Ball.m_LineHelper.Show(false); m_Ball.m_FingerHelper.Show(false); }
private void LoadEnrollLesson(int customerId) { ItemReserveDAO cd = new ItemReserveDAO(); DataSet set = cd.GetAllItemLessonNormal(customerId); tabItemLesson = set.Tables[0]; foreach (DataRow r in tabItemLesson.Rows) { ComplexButton b = new ComplexButton(); b.Location = new System.Drawing.Point(3, 3); b.Name = "complexButtonLesson" + r["LessonId"].ToString(); b.Size = new System.Drawing.Size(107, 48); b.TabIndex = 0; b.Text = r["LessonName"].ToString(); b.DataValue = r; b.Click += new System.EventHandler(complexButtonLesson_Click); flowLayoutPanelLesson.Controls.Add(b); } //tabCustomer = set.Tables[0]; //lookUpEdit.Properties.DataSource = tabCustomer; }
private void complexButtonLesson_Click(object sender, EventArgs e) { ComplexButton b = sender as ComplexButton; if (b == null) { return; } DataRow r = b.DataValue as DataRow; if (r == null) { return; } DataRow newRow = tabSelect.NewRow(); tabSelect.Rows.Add(newRow); newRow["FlowSerial"] = r["FlowSerial"]; newRow["LessonId"] = r["LessonId"]; newRow["LessonName"] = r["LessonName"]; newRow["ItemTotal"] = r["ItemTotal"]; newRow["CurrentConsume"] = 1; int remain = 0; int consumed = 0; try { remain = Convert.ToInt32(r["RemainCount"].ToString()); consumed = Convert.ToInt32(r["ItemTotal"].ToString()) - remain; } catch { } // 每次消费一个课时 newRow["Remain"] = remain - 1; newRow["LessonConsumed"] = consumed; b.Enabled = false; }