public void SetMember(string name, object value) { IPatternElement patternElement; if (Pattern != null) { patternElement = Pattern.GetPatternElement(name); } else { patternElement = MatchClass.GetPatternElement(name); } if (patternElement is IPatternNode) { SetNode(name, (INode)value); } else if (patternElement is IPatternEdge) { SetEdge(name, (IEdge)value); } else //patternElement is IPatternVariable { SetVariable(name, value); } }
public void initGUIMatchesLayout() { myTeamGroup = FindViewById <RadioGroup>(Resource.Id.radioGroup1); MTF = FindViewById <RadioButton>(Resource.Id.MTFall); MTTF = FindViewById <RadioButton>(Resource.Id.MTTechFall); MTMD = FindViewById <RadioButton>(Resource.Id.MTMajorDecision); MTD = FindViewById <RadioButton>(Resource.Id.MTDecision); OF = FindViewById <RadioButton>(Resource.Id.OFall); OTF = FindViewById <RadioButton>(Resource.Id.OTechFall); OMD = FindViewById <RadioButton>(Resource.Id.OMajorDecision); OD = FindViewById <RadioButton>(Resource.Id.ODecision); myTeamMatch = FindViewById <TextView>(Resource.Id.myTeamMatch); opponentMatch = FindViewById <TextView>(Resource.Id.oppMatch); oppGroup = FindViewById <RadioGroup>(Resource.Id.radioGroup2); weighClasses = FindViewById <Spinner>(Resource.Id.weightClasses); matchesLeftList = FindViewById <TextView>(Resource.Id.MatchLeftlistClasses); homeShow = FindViewById <TextView>(Resource.Id.homeShowFirst); awayShow = FindViewById <TextView>(Resource.Id.awayShowFirst); MTF.Click += myTeamGroupOnClick; MTTF.Click += myTeamGroupOnClick; MTMD.Click += myTeamGroupOnClick; MTD.Click += myTeamGroupOnClick; OF.Click += oppGroupOnClick; OTF.Click += oppGroupOnClick; OMD.Click += oppGroupOnClick; OD.Click += oppGroupOnClick; var adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerItem, weighClassList); adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); weighClasses.Adapter = adapter; myTeamMatch.Text = Team1; opponentMatch.Text = Team2; weighClasses.ItemSelected += weighClassesOnClick; //resets the current match to 106 currentMatch = matchList[0]; whoShowFirst(); matchleftString = ""; //get list for remaining matches for (int i = 0; i < matchList.Length; i++) { if (matchList[i].GetMatchResult() == 0) { matchleftString += matchList[i].getWeighClass() + ", "; } } if (matchleftString != "") { matchleftString = matchleftString.Substring(0, matchleftString.Length - 2); } matchesLeftList.Text = matchleftString; }
public void AdvanceWeighClasses() { int pos = currentMatch.getIndexedLocation(); if (pos == matchList.Length - 1) { pos = 0; } currentMatch = matchList[pos + 1]; weighClasses.SetSelection(currentMatch.getIndexedLocation()); }
public void StartMatch(string selectedStage, PlayerClass currentPlayer) { CurrentMatchClass.availableHints = 5; CurrentMatchClass.currentStage = "5"; CurrentMatchClass.playerTokenPosition = 0; CurrentMatchClass.ComputerTokenPosition = 0; PlayerPrefs.SetInt("playerToken1Position", 0); PlayerPrefs.SetInt("playerToken2Position", 0); PlayerPrefs.SetInt("ComputerToken1Position", 0); PlayerPrefs.SetInt("ComputerToken2Position", 0); Debug.Log("Available Rerolls" + myPlayer.AvailableRerolls + ":" + CurrentMatchClass.availableHints); // Script.matchClass = CurrentMatchClass; CurrentMatchClass = new MatchClass(selectedStage, availableHints, playerTokenPosition, ComputerTokenPosition); }
private void weighClassesOnClick(object sender, AdapterView.ItemSelectedEventArgs e) { currentMatch = matchList[e.Position]; myTeamGroup.ClearCheck(); oppGroup.ClearCheck(); switch (currentMatch.GetMatchResult()) { case (0): break; case 1: MTF.Checked = true; break; case 2: MTTF.Checked = true; break; case 3: MTMD.Checked = true; break; case 4: MTD.Checked = true; break; case 5: OF.Checked = true; break; case 6: OTF.Checked = true; break; case 7: OMD.Checked = true; break; case 8: OD.Checked = true; break; } whoShowFirst(); }
public ResultData Entrance(string type, string name, string date, string code, string parameter) { //OperationContext context = OperationContext.Current; EntranceHelper eHelper = new EntranceHelper(); if (!eHelper.GetCode(date).Equals(code)) { return(new ResultData { Type = 0, Message = "验证码错误" }); //Utility.GetJson(0, "验证码错误!"); } else { MatchClass mc = eHelper.GetMatchClass(type); if (mc == null) { return(new ResultData { Type = 0, Message = "未找到对象!" }); } object objClass = System.Reflection.Assembly.Load(mc.Library).CreateInstance(mc.ClassName); if (objClass == null) { return(new ResultData { Type = 0, Message = "未找到对象!" }); } MethodInfo method = objClass.GetType().GetMethod(name); if (method == null) { return(new ResultData { Type = 0, Message = "未找到对象!" }); } try { ParameterInfo[] parameterInfos = method.GetParameters(); object[] objvalue = null; JObject jobject = new JObject(); if (!Utils.IsNullOrEmpty(parameter)) { jobject = JObject.Parse(parameter); } if (jobject.Count != parameterInfos.Length) { return(new ResultData { Type = 0, Message = "未找到对象!" }); } objvalue = new object[parameterInfos.Length]; for (int i = 0; i < parameterInfos.Length; i++) { ParameterInfo parameterInfo = parameterInfos[i]; if (jobject[parameterInfo.Name] == null) { return(new ResultData { Type = 0, Message = "未找到对象!" }); } if (jobject[parameterInfo.Name].Type == JTokenType.Null) { objvalue[i] = null; continue; } objvalue[i] = Utility.valueType(parameterInfo.ParameterType, jobject.Value <JValue>(parameterInfo.Name).Value); } string resultJson = Convert.ToString(method.Invoke(objClass, objvalue)); JObject _jobject = JObject.Parse(resultJson); int Type = _jobject.Value <int>("type"); string Message = _jobject.Value <string>("message"); object Data = _jobject.Value <object>("data"); int Count = _jobject.Value <int>("count"); string datajson = Utils.Serialize(Data); //JObject _jobject2 = JObject.Parse(datajson); ResultData obj = new ResultData { Type = Type, Message = Message, Data = "", Count = Count }; return(obj); } catch (Exception exe) { return(new ResultData { Type = 0, Message = exe.Message }); } } }