private void PlotMP() { for (int y = 0; y < mm; y++) { double mx = m[y].x + Pb.Width / 2; double my = m[y].y + Pb.Height / 2; int mxi = Convert.ToInt32(mx + 0.5); int myi = Convert.ToInt32(my + 0.5); SolidBrush myBrush = new SolidBrush(Color.Red); SolidBrush CBrush = new SolidBrush(Color.White); Graphics g = Pb.CreateGraphics(); Rectangle rect = new Rectangle(pmxi[y] - Convert.ToInt16(m[y].strength) / 2, pmyi[y] - Convert.ToInt16(m[y].strength) / 2, Convert.ToInt16(m[y].strength * 4), Convert.ToInt16(m[y].strength * 4)); //g.DrawEllipse(CPen, pmxi, pmyi, 4, 4); //g.DrawEllipse(CPen, pmxi1, pmyi1, 4, 4); g.FillEllipse(CBrush, rect); rect = new Rectangle(mxi - Convert.ToInt16(m[y].strength) / 2, myi - Convert.ToInt16(m[y].strength) / 2, Convert.ToInt16(m[y].strength * 4), Convert.ToInt16(m[y].strength * 4)); //g.DrawEllipse(myPen, mxi, myi, 4, 4); //g.DrawEllipse(myPen, mxi1, myi1, 4, 4); g.FillEllipse(myBrush, rect); pmxi[y] = mxi; pmyi[y] = myi; g.Dispose(); myBrush.Dispose(); CBrush.Dispose(); } }
// 接收响应并处理 public void HandleMessage(byte[] body) { try { var rsp = Pb.DecodeRsp(body); var seq = rsp.RspWrap1.Seq; SendQueueValue val = null; SendQueue.TryGetValue(seq + "", out val); var callback = val?.response; if (val == null) { return; } // 处理错误码,并拦截 value.response EventUpload.PushRequestEvent(new ReqEventParam { RqCmd = val.Cmd, RqSq = rsp.RspWrap1.Seq, RqCd = rsp.RspWrap1.ErrCode, Time = Convert.ToInt64((DateTime.Now - val.Time).TotalMilliseconds) }); // 心跳不拦截 if (val.Cmd != (int)ProtoCmd.ECmdHeartBeatReq && HandleErrCode(rsp.RspWrap1)) { return; } callback?.Invoke(rsp); return; } catch (Exception e) { Debugger.Log(e.ToString()); } }
private static void InitModules() { Core.User = new User.User(Sdk.BstCallbacks); Core.Matcher = new Matcher.Matcher(Sdk.BstCallbacks); Core.Sender = new Sender.Sender(Sdk.BstCallbacks); Core.Room = new Room.Room(Sdk.BstCallbacks); Core.Group = new Group.Group(Sdk.BstCallbacks); Core.FrameSender = new FrameSender(Sdk.BstCallbacks); Core.Socket1 = new Socket(0, false, null); Core.Socket2 = new Socket(1, true, null); Core.Pinger1 = new Pinger(Sdk.BstCallbacks, 0, null); Core.Pinger2 = new Pinger(Sdk.BstCallbacks, 1, FrameSender); var route1 = new BaseNetUtil[7] { User, Room, Group, Sender, FrameSender.NetUtil1, Pinger1, Matcher }; var route2 = new BaseNetUtil[2] { FrameSender.NetUtil2, Pinger2 }; foreach (var request in route1) { request.BindSocket(Core.Socket1); } foreach (var request in route2) { request.BindSocket(Core.Socket2); } Pb.Init(); Sdk.UpdateSdk(); }
private void button2_Click(object sender, EventArgs e) { Pb.Refresh(); cc = Convert.ToInt16(ENX.Text); mm = Convert.ToInt16(MPX.Text); LoadData(); }
// 处理接受的广播消息 public static void HandleMessage(byte[] body) { var bst = Pb.DecodeBst(body); var handler = BroadcastHandlers[bst.BstWrap2.Type]; handler?.Invoke(bst, bst.BstWrap1.Seq); }
// 处理接受的广播消息 public static void HandleMessage(byte[] body) { var bst = Pb.DecodeBst(body); BroadcastCallback handler = null; BroadcastHandlers.TryGetValue(bst.BstWrap2.Type, out handler); handler?.Invoke(bst, bst.BstWrap1.Seq); }
public CastSpellAction(Recipe recipe, int repeat, RepeatCalculationType repeatType) : this() { Recipe = recipe; Repeat = new DynamicProperty <int>(this, repeat.ToString(CultureInfo.InvariantCulture)); Entry = recipe.SpellId; RepeatType = repeatType; //Properties["Recipe"].Show = true; Properties["SpellName"].Value = SpellName; Pb.UpdateMaterials(); }
public CastSpellAction(Recipe recipe, int repeat, RepeatCalculationType repeatType) : this() { Recipe = recipe; Repeat = repeat; Entry = recipe.ID; this.RepeatType = repeatType; //Properties["Recipe"].Show = true; Properties["SpellName"].Value = SpellName; Pb.UpdateMaterials(); }
void showWinPicture() { Text.text = "you win"; Pnon.SetActive(false); Pa.SetActive(false); Pb.SetActive(false); Pc.SetActive(false); Pd.SetActive(false); Pe.SetActive(false); Pwin.SetActive(false); KK = ShowPic(WINNUM + 1, WIN); }
// check tradeskill list if spell is a recipe the player knows and updates Recipe if so. public void CheckTradeskillList() { Recipe = Pb.TradeSkillList.Where(t => t.Recipes.ContainsKey(Entry)).Select(t => t.Recipes[Entry]).FirstOrDefault(); if (IsRecipe) { //Properties["Recipe"].Show = true; Properties["SpellName"].Value = SpellName; Pb.UpdateMaterials(); } else { //Properties["Recipe"].Show = false; Properties["SpellName"].Value = SpellName; } }
private void Plot() { Pen ClearPen = new Pen(Color.White); Pen myPen = new Pen(Color.Blue, 1); Graphics g = Pb.CreateGraphics(); for (int x = 0; x < cc; x++) { double px = c[x].x + Pb.Width / 2; double py = c[x].y + Pb.Height / 2; int pxi = Convert.ToInt32(px + 0.5); int pyi = Convert.ToInt32(py + 0.5); g.DrawEllipse(ClearPen, opxi[x], opyi[x], Convert.ToInt16(c[x].strength) * 3, Convert.ToInt16(c[x].strength) * 3); g.DrawEllipse(myPen, pxi, pyi, Convert.ToInt16(c[x].strength) * 3, Convert.ToInt16(c[x].strength) * 3); opxi[x] = pxi; opyi[x] = pyi; } g.Dispose(); myPen.Dispose(); ClearPen.Dispose(); }
void showPicture(char WH) { switch (WH) { case 'S': Text.text = "you're in next LEVEL"; Pnon.SetActive(false); Pwrong.SetActive(false); Pa.SetActive(false); Pb.SetActive(false); Pc.SetActive(false); Pd.SetActive(false); Pe.SetActive(false); Pwin.SetActive(false); Pnext.SetActive(true); Pnext1.SetActive(true); NEXTL.SetActive(false); break; case 'A': Text.text = "A" + "X " + positionX + "Y " + positionY + "Z " + positionZ; Pnon.SetActive(false); Pwrong.SetActive(false); Pa.SetActive(true); Pb.SetActive(false); Pc.SetActive(false); Pd.SetActive(false); Pe.SetActive(false); Pwin.SetActive(false); Pnext.SetActive(false); Pnext1.SetActive(false); NEXTL.SetActive(false); break; case 'B': Text.text = "B" + "X " + positionX + "Y " + positionY + "Z " + positionZ; Pnon.SetActive(false); Pwrong.SetActive(false); Pa.SetActive(false); Pb.SetActive(true); Pc.SetActive(false); Pd.SetActive(false); Pe.SetActive(false); Pwin.SetActive(false); Pnext.SetActive(false); Pnext1.SetActive(false); NEXTL.SetActive(false); break; case 'C': Text.text = "C" + "X " + positionX + "Y " + positionY + "Z " + positionZ; Pnon.SetActive(false); Pwrong.SetActive(false); Pa.SetActive(false); Pb.SetActive(false); Pc.SetActive(true); Pd.SetActive(false); Pe.SetActive(false); Pwin.SetActive(false); Pnext.SetActive(false); Pnext1.SetActive(false); NEXTL.SetActive(false); break; case 'D': Text.text = "D" + "X " + positionX + "Y " + positionY + "Z " + positionZ; Pnon.SetActive(false); Pwrong.SetActive(false); Pa.SetActive(false); Pb.SetActive(false); Pc.SetActive(false); Pd.SetActive(true); Pe.SetActive(false); Pwin.SetActive(false); Pnext.SetActive(false); Pnext1.SetActive(false); NEXTL.SetActive(false); break; case 'E': Text.text = "E" + "X " + positionX + "Y " + positionY + "Z " + positionZ; Pnon.SetActive(false); Pwrong.SetActive(false); Pa.SetActive(false); Pb.SetActive(false); Pc.SetActive(false); Pd.SetActive(false); Pe.SetActive(true); Pwin.SetActive(false); Pnext.SetActive(false); Pnext1.SetActive(false); NEXTL.SetActive(false); break; case 'N': Text.text = "NON" + "X " + positionX + "Y " + positionY + "Z " + positionZ; Pnon.SetActive(true); Pwrong.SetActive(false); Pa.SetActive(false); Pb.SetActive(false); Pc.SetActive(false); Pd.SetActive(false); Pe.SetActive(false); Pwin.SetActive(false); Pnext.SetActive(false); Pnext1.SetActive(false); NEXTL.SetActive(false); break; case 'W': Pnon.SetActive(false); Pwrong.SetActive(true); Pa.SetActive(false); Pb.SetActive(false); Pc.SetActive(false); Pd.SetActive(false); Pe.SetActive(false); Pwin.SetActive(false); Pnext.SetActive(false); Pnext1.SetActive(false); NEXTL.SetActive(false); //KKKEEP = false; break; } }
//int frameRate = 250; // Use this for initialization void Start() { // Time.captureFramerate = frameRate; Time.fixedDeltaTime = 1.0f; Pa.SetActive(false); Pb.SetActive(false); Pc.SetActive(false); Pd.SetActive(false); Pe.SetActive(false); Pwin.SetActive(false); Pnon.SetActive(true); Pwrong.SetActive(false); Pnext.SetActive(false); Pnext1.SetActive(false); NEXTL.SetActive(false); animatorhand = Hand.GetComponent <Animator>(); //print(animatorhand.GetInstanceID ()); La.SetActive(false); Ld.SetActive(false); Da.SetActive(false); Db.SetActive(false); Dc.SetActive(false); Dd.SetActive(false); De.SetActive(false); Hand.SetActive(false); whichF = 0; nowKeep = 0; showcount = 0; playercount = 0; currentlevel = 0; Last = 'F'; nowplaying = false; int temptnum; #region random System.Random randNum = new System.Random(); for (int i = 0; i < flowerlight_L0.Length;) { temptnum = randNum.Next(Min, Max); if (i == 0) { flowerlight_L0[i] = 0; i++; } else if (i == 1) { flowerlight_L0[i] = 1; i++; } else if (i == 2) { flowerlight_L0[i] = 4; i++; } } for (int i = 0; i < flowerlight_L1.Length;) { temptnum = randNum.Next(Min, Max); if (i == 0) { flowerlight_L1[i] = 0; i++; } else if (temptnum != flowerlight_L1[i - 1]) { flowerlight_L1[i] = temptnum; i++; } } for (int i = 0; i < flowerlight_L2.Length;) { temptnum = randNum.Next(Min, Max); if (i == 0) { flowerlight_L2[i] = 0; i++; } else if (temptnum != flowerlight_L2[i - 1]) { flowerlight_L2[i] = temptnum; i++; } } for (int i = 0; i < flowerlight_L3.Length;) { temptnum = randNum.Next(Min, Max); if (i == 0) { flowerlight_L3[i] = 0; i++; } else if (temptnum != flowerlight_L3[i - 1]) { flowerlight_L3[i] = temptnum; i++; } } #endregion cantouch = false; tempkeep = false; #region show WIN for (int i = 0; i < WINNUM; i++) { WIN[i].SetActive(false); } KK = false; #endregion }
private void CastSpellActionPropertyChanged(object sender, MetaPropArgs e) { IsDone = false; Pb.UpdateMaterials(); }
/// <summary> /// Plays the role of a hash function of a certain type. /// </summary> /// <returns>Integer number</returns> public override int GetHashCode() { return(Y.GetHashCode() ^ Pb.GetHashCode() ^ Pr.GetHashCode()); }
// 发送消息请求 public string SendRequest(ByteString body, int subcmd, NetResponseCallback response, Action <ResponseEvent> callback, string cmd, string seq) { if (seq.Length == 0) { seq = Guid.NewGuid().ToString(); var sendQueueVal = new SendQueueValue { Time = DateTime.Now, IsSocketSend = false, Cmd = (int)subcmd, resend = () => this.SendRequest(body, subcmd, response, callback, cmd, seq), response = msg => { response(true, msg, callback); DeleteSendQueue(seq); } }; sendQueueVal.sendSuccess = () => { // if(Socket.Id == 1) Debugger.Log("handle send success {0}", seq); sendQueueVal.IsSocketSend = true; }; sendQueueVal.remove = () => { DeleteSendQueue(seq); }; sendQueueVal.sendFail = (errCode, errMsg) => { var errMessage = "消息发送失败," + errMsg + "[" + errCode + "]"; var rspWrap1 = new ClientSendServerRspWrap1 { Seq = seq, ErrCode = errCode, ErrMsg = errMessage }; response(false, new DecodeRspResult { RspWrap1 = rspWrap1, }, callback); DeleteSendQueue(seq); }; AddSendQueue(seq, sendQueueVal); } // PB request = new PB(); var qAppRequest = new ClientSendServerReqWrap1 { Version = RequestHeader.Version, AppName = RequestHeader.AppName, ClientIp = RequestHeader.ClientIp, ServiceIp = RequestHeader.ServiceIp, Business = RequestHeader.Business, AuthKey = RequestHeader.AuthKey, AuthType = RequestHeader.AuthType, AuthIp = RequestHeader.AuthIp, GameId = RequestHeader.GameId, Uid = RequestHeader.Uid, PlayerId = RequestHeader.PlayerId, Cmd = cmd, Seq = seq }; var accessReq = new ClientSendServerReqWrap2(); accessReq.Cmd = (ProtoCmd)subcmd; var data = Pb.EncodeReq(qAppRequest, accessReq, body); if (data.Length > _maxDataLength) { SendQueueValue val = null; SendQueue.TryGetValue(seq + "", out val); var timer = new Timer(); timer.SetTimeout(() => { if (val != null) { val.sendFail((int)QAppProtoErrCode.EcSdkSendFail, "数据长度超限"); } }, 0); return(seq); } var reqData = BuildData(data); return(this.Send(reqData, seq, (ProtoCmd)subcmd)); }
void CastSpellAction_PropertyChanged(object sender, EventArgs e) { IsDone = false; Pb.UpdateMaterials(); }
/// <summary> /// Returns a System.String object that represents the current object. /// </summary> /// <returns>Text as a sequence of Unicode characters</returns> public override string ToString() { return(Y.ToString() + "\n" + Pb.ToString() + "\n" + Pr.ToString()); }
private User ConvertUser(Pb.Dal.User user) { return new User() { Id = user.Id == Guid.Empty ? Guid.NewGuid() : user.Id, Email = user.Email, //Password = user.Password, FirstName = user.FirstName, LastName = user.LastName, Created = user.Created, Modified = user.Modified, Deleted = user.Deleted }; }
public GameObject Pa, Pb; // The two intersections private void Start() { TheSphere.GetComponent <Renderer>().material.color = Color.red; Pa.GetComponent <Renderer>().material.color = Color.black; Pb.GetComponent <Renderer>().material.color = Color.black; }