public MessageOLD(Head h,byte[] b) : this(h) { for (int i = 1; i < b.GetLength(0); i++) { this.mssg[i]=b[i]; } }
private List<MsgRequest> FormRequest() { List<MsgRequest> ret = new List<MsgRequest> (); //if (elist.Count == 0) { // return null; //} var elist = EventReporter.ReportEvent (); foreach (var e in elist) { var req = new MsgRequest(); var head = new Head(); var content = new Content(); var msg = new Msg(); head.srcID = e.sponsorId; head.srcType = SRCType.UNITYC; head.dstIDs.InsertRange(0,e.targetIdList); msg.type = Support.MsgTypeConverter(e.type); msg.body = World.GetInstance().GetGameObject(e.sponsorId).GetComponent<EventGenerator>().SelfSerialize(e.type,e.rawContent); content.msg.Add(msg); req.content = content; req.head = head; ret.Add(req); } return ret; }
public AddEditHeadModel() { SaveButtonClicked = new SaveNewHead(this); CancelButtonClicked = new CancelAddHeadPage(this); Head = new Head(); //CurrentHeadOption = HeadType.Revenue; }
public MessageOLD(Head h) { if (h == Head.EMPTY) { mssg=new byte[256]; } this.mssg[0] = (byte)h; }
void Awake() { anim = GetComponent<Animator>(); //*** Eyes { GameObject leftEyeGO = MiscUtils.FindChildInHierarchy(gameObject, "EyeLeft"); if (leftEyeGO) { ownEyeLeftTransform = leftEyeGO.transform; ownEyeRightTransform = MiscUtils.FindChildInHierarchy(gameObject, "EyeRight").transform; // The eyesRootTransform will be the reference transform to move the eyes in. // We could use the head bone, but that might have a weird orientation eyesRootTransform = new GameObject(name + "_eyesRoot").transform; eyesRootTransform.position = 0.5f * (ownEyeLeftTransform.position + ownEyeRightTransform.position); eyesRootTransform.rotation = ownEyeLeftTransform.rotation; eyesRootTransform.parent = ownEyeLeftTransform.parent; ownEyeLeftTransform.parent = ownEyeRightTransform.parent = eyesRootTransform; } } cameraControlTwoPerspectives = MiscUtils.GetComponentSafely<CameraControlTwoPerspectives>("CameraControls"); targetHead = targetBodyTransform.GetComponentInChildren<Head>(); isSocrates = transform.parent.name == "Socrates"; }
public HeadMenu(Head head) { Verify.Argument.IsValidGitObject(head, "head"); _head = head; Items.Add(GuiItemFactory.GetViewReflogItem<ToolStripMenuItem>(head)); }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); decayTime = reader.ReadDateTime(); mountedHead = reader.ReadItem() as Head; }
public void CreateHead_ToString_ReturnsEmptyTag() { Head head = new Head(); string actual = head.ToString(); string expected = "<head></head>"; Assert.AreEqual(expected, actual); }
public EquipmentSet(Foot foot, Head head, Hand hand, Weapon weapon, Pants pants, Torso torso) { this._foot = foot; this._head = head; this._hand = hand; this._weapon = weapon; this._pants = pants; this._torso = torso; }
public void RemoveHeadCallback( object state ) { //(if you remove/add something during a ws the server crashes, hence the freeze during saves) if( !World.Saving && mountedHead != null ) { mountedHead.Delete(); mountedHead = null; } }
public void HeadWithTitle_ToString_ReturnHeadWithTitle() { Head head = new Head(); head.Title = "some title"; string actual = head.ToString(); string expected = "<head><title>some title</title></head>"; Assert.AreEqual(expected, actual); }
public void CreateHead_ToStringAppendTo_ReturnsSameResult() { Head head = new Head(); string actual = head.ToString(); StringBuilder sb = new StringBuilder(); head.AppendTo(sb); Assert.AreEqual(actual, sb.ToString()); }
void Awake() { activator = GetComponentInChildren<Activator>(); eye = GetComponentInChildren<Eye>(); inventory = GetComponentInChildren<Inventory>(); lastPositionKeeper = GetComponentInChildren<LastPositionKeeper>(); head = GetComponentInChildren<Head>(); cameraPlace = GetComponentInChildren<CameraPlace>(); undo = GetComponentInChildren<Undo>(); characterController = GetComponentInChildren<CharacterController>(); rewind = GetComponentInChildren<Rewind>(); slowmo = GetComponentInChildren<Slowmo>(); gravity = GetComponentInChildren<Gravity>(); all.Add(this); }
public static async Task WriteOutput(HttpResponse Response, string Title, Head.Tag[] HeadTags, string Body) { var sb = new StringBuilder(); sb.Append("<!DOCTYPE html><head><meta charset=\"utf-8\">"); if (Title != null) { sb.Append("<title>" + Title + "</title>"); } if (HeadTags != null) { foreach (var a in HeadTags) { sb.Append(a.Output()); } } sb.Append("</head><body>"); sb.Append(Body); sb.Append("</body></html>"); await Response.WriteAsync(sb.ToString()); }
public override void LoadContent() { _background = DrawingHelper.GetTexture( "background_nofaces" ); if ( _brettHead == null ) { _brettHead = new Head( "BrettNormal", "BrettOpen", new Vector2( 430, 115 ), new Vector2( 425, 120 ) ); _laynaHead = new Head( "LaynaNormal", "LaynaOpen", new Vector2( 300, 120 ), new Vector2( 290, 125 ) ); _dunkHead = new Head( "DunkNormal", "DunkOpen", new Vector2( 363, 45 ), new Vector2( 330, 50 ) ); _brettHead.LoadContent(); _laynaHead.LoadContent(); _dunkHead.LoadContent(); _brettHead.ShakeForever(); _laynaHead.ShakeForever(); _dunkHead.ShakeForever(); } SoundHelper.LoopVows(); }
private void InitBlock() { if (!Head.containsKey(g.toString())) { //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'" TreeSet <Integer> H = new TreeSet <Integer>(); //UPGRADE_NOTE: There is an untranslated Statement. Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'" while (arc_g_it.hasNext()) { Arc arc_g = arc_g_it.next(); if (arc_g.From == init) { H.add(arc_g.To); } } Head.put(g.toString(), H); } if (!Tail.containsKey(h.toString())) { FiniteAutomaton fa = new FiniteAutomaton(); //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'" OneToOneTreeMap <Integer, cav2010.automata.FAState> st = new OneToOneTreeMap <Integer, cav2010.automata.FAState>(); //UPGRADE_NOTE: There is an untranslated Statement. Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'" while (arc_h_it.hasNext()) { Arc arc_h = arc_h_it.next(); if (!st.containsKey(arc_h.From)) { st.put(arc_h.From, fa.createState()); } if (!st.containsKey(arc_h.To)) { st.put(arc_h.To, fa.createState()); } fa.addTransition(st.getValue(arc_h.From), st.getValue(arc_h.To), arc_h.Label?"1":"0"); } SCC s = new SCC(fa); //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'" TreeSet <Integer> T = new TreeSet <Integer>(); //UPGRADE_NOTE: There is an untranslated Statement. Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'" while (s_it.hasNext()) { T.add(st.getKey(s_it.next())); } int TailSize = 0; //UPGRADE_NOTE: There is an untranslated Statement. Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'" while (TailSize != T.size()) { TailSize = T.size(); //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'" TreeSet <Arc> isolatedArcsTemp = new TreeSet <Arc>(); //UPGRADE_NOTE: There is an untranslated Statement. Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'" while (arc_it.hasNext()) { Arc arc = arc_it.next(); if (!T.contains(arc.To)) { isolatedArcsTemp.add(arc); } else { T.add(arc.From); } } isolatedArcs = isolatedArcsTemp; } Tail.put(h.toString(), T); } //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'" TreeSet <Integer> intersection = new TreeSet <Integer>(); intersection.addAll(Head.get_Renamed(g.toString())); intersection.retainAll(Tail.get_Renamed(h.toString())); if (debug_Renamed_Field) { if (intersection.isEmpty()) { debug("g:" + g + ", Head: " + Head.get_Renamed(g.toString())); debug("h:" + h + ", Tail: " + Tail.get_Renamed(h.toString())); } } return(!intersection.isEmpty()); //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'" TreeSet <Arc> result = new TreeSet <Arc>(); //UPGRADE_NOTE: There is an untranslated Statement. Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'" while (arc_it1.hasNext()) { Arc cur = arc_it1.next(); bool canAdd = true; //UPGRADE_NOTE: There is an untranslated Statement. Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'" while (arc_it2.hasNext()) { Arc other = arc_it2.next(); if (cur.From == other.From) { if (!cur.Label || other.Label) { if (cur.To != other.To) { //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'" if (rel.contains(new Pair <FAState, FAState>(new FAState(cur.getTo()), new FAState(other.getTo()))) && result.contains(other)) { canAdd = false; break; } } } } } if (canAdd) { result.add(cur); } } return(result); //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'" ArrayList <TreeSet <Arc> > graphs = new ArrayList <TreeSet <Arc> >(); //UPGRADE_NOTE: There is an untranslated Statement. Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'" while (symbol_it.hasNext()) { //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'" TreeSet <Arc> graph = new TreeSet <Arc>(); System.String sym = symbol_it.next(); //UPGRADE_NOTE: There is an untranslated Statement. Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'" while (from_it.hasNext()) { FAState from = from_it.next(); if (from.getNext(sym) != null) { //UPGRADE_NOTE: There is an untranslated Statement. Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'" while (to_it.hasNext()) { FAState to = to_it.next(); if (input.F.contains(from) || input.F.contains(to)) { graph.add(new Arc(from.id, true, to.id)); } else { graph.add(new Arc(from.id, false, to.id)); } } } } //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'" ArrayList <TreeSet <Arc> > toRemove = new ArrayList <TreeSet <Arc> >(); bool canAdd = true; //UPGRADE_NOTE: There is an untranslated Statement. Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'" while (old_it.hasNext()) { //UPGRADE_NOTE: There is an untranslated Statement. Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'" if (smallerThan(old, graph, rel)) { canAdd = false; break; } else if (smallerThan(graph, old, rel)) { toRemove.add(old); } } if (canAdd) { if (opt2) { graphs.add(min(graph)); } else { graphs.add(graph); } graphs.removeAll(toRemove); } } return(graphs); //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'" TreeSet <Arc> f = new TreeSet <Arc>(); //UPGRADE_NOTE: There is an untranslated Statement. Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'" while (arc_g_it.hasNext()) { Arc arc_g = arc_g_it.next(); //UPGRADE_NOTE: There is an untranslated Statement. Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'" while (arc_h_it.hasNext()) { Arc arc_h = arc_h_it.next(); if (arc_g.To == arc_h.From) { if (arc_g.Label || arc_h.Label) { f.add(new Arc(arc_g.From, true, arc_h.To)); f.remove(new Arc(arc_g.From, false, arc_h.To)); } else { if (!f.contains(new Arc(arc_g.From, true, arc_h.To))) { f.add(new Arc(arc_g.From, false, arc_h.To)); } } } } } return(f); //UPGRADE_NOTE: There is an untranslated Statement. Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'" while (arc_g_it.hasNext()) { Arc arc_g = arc_g_it.next(); bool has_larger = false; //UPGRADE_NOTE: There is an untranslated Statement. Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'" while (arc_h_it.hasNext()) { Arc arc_h = arc_h_it.next(); if (arc_g.From == arc_h.From) { if (!arc_g.Label || arc_h.Label) { //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'" if (rel.contains(new Pair <FAState, FAState>(new FAState(arc_g.getTo()), new FAState(arc_h.getTo())))) { has_larger = true; break; } } } } if (!has_larger) { return(false); } } return(true); FAState[] states = input.states.toArray(new FAState[0]); bool[] isFinal = new bool[states.Length]; bool[][] fsim = new bool[states.Length][]; for (int i = 0; i < states.Length; i++) { fsim[i] = new bool[states.Length]; } // sim[u][v]=true iff v in sim(u) iff v simulates u for (int i = 0; i < states.Length; i++) { isFinal[i] = input.F.contains(states[i]); } for (int i = 0; i < states.Length; i++) { for (int j = i; j < states.Length; j++) { fsim[i][j] = (!isFinal[i] || isFinal[j]) && states[j].covers(states[i]); fsim[j][i] = (isFinal[i] || !isFinal[j]) && states[i].covers(states[j]); } } Simulation sim = new Simulation(); //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'" Set <Pair <FAState, FAState> > FSim = sim.FastFSimRelNBW(input, fsim); return(FSim); }
private void CreatInfoArray() { infos = new string[QQGlobal.QQ_COUNT_GET_USER_INFO_FIELD]; infos[QQ_NUM] = QQ.ToString(); infos[NICK] = Nick; infos[COUNTRY] = Country; infos[PROVINCE] = Province; infos[ZIPCODE] = ZipCode; infos[ADDRESS] = Address; infos[TELEPHONE] = Telephone; infos[AGE] = Age.ToString(); infos[GENDER] = Gender; // 10. 姓名 infos[NAME] = Name; // 11. Email infos[EMAIL] = Email; // 12. 寻呼机sn,(sn是什么玩意,我也不知道) infos[PAGER_SN] = ""; // 13. 寻呼机号 infos[PAGER] = ""; // 14. 寻呼机服务提供商 infos[PAGER_SP] = ""; // 15. 寻呼机base num(也不清楚这是什么) infos[PAGER_BASE_NUM] = ""; // 16. 寻呼机类型 infos[PAGER_TYPE] = ""; // 17. 职业 infos[OCCUPATION] = Occupation; // 18. 主页 infos[HOMEPAGE] = HomePage; // 19. 认证类型(应该是被人加自己为好友的时候的认证类型把) infos[AUTH_TYPE] = ((int)AuthType).ToString(); // 20. unknown 1 infos[UNKNOWN_1] = ""; // 21. unknown 2 infos[UNKNOWN_2] = ""; // 22. 头像,头像是用一个数代表的,比如27, 因为QQ目录下的头像是从1开始编号的, // 但是这个头像的数字却是从0开始计数的。并且注意,QQ的目录下面每种头像都 // 有3个bmp,所以按数字这么一排,27应该是10-1.bmp infos[HEAD] = Head.ToString(); // 23. 手机号 infos[MOBILE] = Mobile; // 24. 手机类型 infos[MOBILE_TYPE] = ""; // 25. 介绍 infos[INTRO] = Intro; // 26. 城市 infos[CITY] = City; // 27. unknown 3 infos[UNKNOWN_3] = ""; // 28. unknown 4 infos[UNKNOWN_4] = ""; // 29. unknown 5 infos[UNKNOWN_5] = ""; // 30. is_open_hp infos[OPEN_HP] = ""; // 31. is_open_contact(通讯方式是否对其他人可见) infos[OPEN_CONTACT] = ((int)OpenContact).ToString(); // 32. 学校 infos[COLLEGE] = College; // 33. 星座 infos[HOROSCOPE] = Horoscope.ToString(); // 34. 生肖 infos[ZODIAC] = Zodiac.ToString(); // 35. 血型 infos[BLOOD] = Blood.ToString(); // 36. UserFlag infos[USER_FLAG] = UserFlag.ToString(); // 37. unknown 6,总是0x2D infos[UNKNOWN_6] = ""; }
/// <inheritdoc /> public override int GetHashCode() { return(HashCodeHelper.Combine(Head.GetHashCode(), m_tail?.GetHashCode() ?? 0)); }
public override bool IsOrCanBeOnlyOfTypes(params SymbolType[] symbolTypes) { return(Head.IsOrCanBeOnlyOfTypes(symbolTypes) || Tail.IsOrCanBeOnlyOfTypes(symbolTypes)); }
public override void LoadContent() { Counter.Reset(); _previousGesture = GestureType.None; _tapLocation = Vector2.Zero; _startVerticalDrag = Vector2.Zero; _endVerticalDrag = Vector2.Zero; _lengthVerticalDrag = 0; _directionVerticalDrag = 0; _startHorizontalDrag = Vector2.Zero; _endHorizontalDrag = Vector2.Zero; _lengthHorizontalDrag = 0; _directionHorizontalDrag = 0; _previousAction = GestureType.None; _waveManager = null; _leftBarrier = 0; _rightBarrier = 0; _lost = false; _won = false; _brettHead = null; _laynaHead = null; _dunkHead = null; _background = null; _background = DrawingHelper.GetTexture( "background_nofaces" ); if ( _brettHead == null ) { _brettHead = new Head( "BrettNormal", "BrettOpen", new Vector2( 430, 115 ), new Vector2( 425, 120 ) ); _laynaHead = new Head( "LaynaNormal", "LaynaOpen", new Vector2( 300, 120 ), new Vector2( 290, 125 ) ); _dunkHead = new Head( "DunkNormal", "DunkOpen", new Vector2( 363, 45 ), new Vector2( 330, 50 ) ); _brettHead.LoadContent(); _laynaHead.LoadContent(); _dunkHead.LoadContent(); } }
/// <summary> /// Adds a value in the <see cref="SkipList{T}"/>. /// </summary> /// <param name="value">The value to add in the <see cref="SkipList{T}"/>.</param> public void Add(T value) { // Gets the nodes which have to be updated(the nodes before the one we want to insert) var nodesForUpdate = new SkipListNode <T> [Height]; var curNode = Head; for (int i = Height - 1; i >= 0; i--) { while (curNode[i] != null && value.CompareTo(curNode[i].Value) > 0) { curNode = curNode[i]; } nodesForUpdate[i] = curNode; } // Check if inserting a duplicate var nodeBeforeNodeForInsertion = nodesForUpdate[0]; if (nodeBeforeNodeForInsertion[0] != null && value.CompareTo(nodeBeforeNodeForInsertion[0].Value) == 0) { throw new ArgumentException("Tried to insert duplicate value!"); } // Generates the height of the new node int height = 1; while (randomizer.NextDouble() < probability && height < Head.Height + 1) { height++; } // Creating the new node var newNode = new SkipListNode <T>(value, height); if (height > Head.Height)// If the new node is higher that the head node { // Icrease the head level Head.IncrementHeight(); Head[Head.Height - 1] = newNode; } // Adding the new node in the list for (int i = 0; i < newNode.Height; i++) { // For every level which have to be updated if (i < nodesForUpdate.Length) { // The new node starts to point where the node before it points. newNode[i] = nodesForUpdate[i][i]; // The old node starts to point to the new inserted node. nodesForUpdate[i][i] = newNode; // Note: // nodesForUpdate is an array of the nodes before the one we add. // nodesForUpdate[i] is the node on the level i before our new node. // nodesForUpdate[i][i] is the reference to the next node on level i. } } Count++; }
public void SetUpOnline(int _playerIndex) { OnCreate?.Invoke(_playerIndex); _pv = GetComponent <PhotonView>(); hitable = gameObject.GetComponent <HitableObj>(); if (_pv == null) { return; } _isOnline = true; dataIndex = _playerIndex; Debug.Log("player index " + dataIndex); if (!_pv.IsMine) { //Destroy(GetComponent<PhysicsControlListeners>()); Destroy(GetComponent <Rigidbody2D>()); Destroy(GetComponent <ActionController>()); //Destroy(body.GetComponent<PlayerAttackControl>()); //Destroy(this); } else { //if (_hasInited){return;} //_hasInited = true; rigid = gameObject.GetComponent <Rigidbody2D>(); listeners = gameObject.GetComponent <PhysicsControlListeners>(); actionController = gameObject.GetComponent <ActionController>(); _otherPlayers = GetOtherPlayer(); SetUpLocalEvent(); string _head_path = "Prefab/Online/Head/" + PlayerSlot.heads_res[(int)PhotonNetwork.LocalPlayer.CustomProperties[CustomPropertyCode.HEAD_CDOE]].name; string _body_path = "Prefab/Online/Body/" + PlayerSlot.body_res[(int)PhotonNetwork.LocalPlayer.CustomProperties[CustomPropertyCode.BODY_CODE]].name; Head _newHead = PhotonNetwork.Instantiate( _head_path, //Instantiate( //Resources.Load<Head>(_head_path), head.transform.position, Quaternion.identity ).GetComponent <Head>(); Body _newBody = PhotonNetwork.Instantiate( _body_path, //Instantiate( //Resources.Load<Body>(_body_path), body.transform.position, Quaternion.identity ).GetComponent <Body>(); //_newBody.transform.SetParent(body.transform.parent); _newBody.transform.SetParent(transform); _newHead.transform.SetParent(transform); //_newHead.transform.SetParent(head.transform.parent); Destroy(head.gameObject); Destroy(body.gameObject); head = _newHead; body = _newBody; RpcSetUPParent(); _pv.RPC("RpcSetupTeam", RpcTarget.All, (int)PhotonNetwork.LocalPlayer.CustomProperties[CustomPropertyCode.TEAM_CODE], (int)PhotonNetwork.LocalPlayer.CustomProperties[CustomPropertyCode.TEAM_LAYER]); SetKey(0); SetupRpcFunction(); //temp //AddLanding(); } }
public void CreateNormalOpmlTest() { Opml opml = new Opml(); opml.Encoding = "UTF-8"; opml.Version = "2.0"; Head head = new Head(); head.Title = "mySubscriptions.opml"; head.DateCreated = DateTime.Parse("Sat, 18 Jun 2005 12:11:52 GMT").ToUniversalTime(); head.DateModified = DateTime.Parse("Tue, 02 Aug 2005 21:42:48 GMT").ToUniversalTime(); head.OwnerName = "fnya"; head.OwnerEmail = "*****@*****.**"; head.OwnerId = "http://news.com.com/"; head.Docs = "http://news.com.com/"; head.ExpansionState.Add("1"); head.ExpansionState.Add("6"); head.ExpansionState.Add("13"); head.ExpansionState.Add("16"); head.ExpansionState.Add("18"); head.ExpansionState.Add("20"); head.VertScrollState = "1"; head.WindowTop = "106"; head.WindowLeft = "106"; head.WindowBottom = "558"; head.WindowRight = "479"; opml.Head = head; Outline outline = new Outline(); outline.Text = "CNET News.com"; outline.IsComment = "true"; outline.IsBreakpoint = "true"; outline.Created = DateTime.Parse("Tue, 02 Aug 2005 21:42:48 GMT").ToUniversalTime(); outline.Category.Add("/Harvard/Berkman"); outline.Category.Add("/Politics"); outline.Description = "Tech news and business reports by CNET News.com."; outline.HTMLUrl = "http://news.com.com/"; outline.Language = "unknown"; outline.Title = "CNET News.com"; outline.Type = "rss"; outline.Version = "RSS2"; outline.XMLUrl = "http://news.com.com/2547-1_3-0-5.xml"; Body body = new Body(); body.Outlines.Add(outline); opml.Body = body; StringBuilder xml = new StringBuilder(); xml.Append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n"); xml.Append("<opml version=\"2.0\">\r\n"); xml.Append("<head>\r\n"); xml.Append("<title>mySubscriptions.opml</title>\r\n"); xml.Append("<dateCreated>Sat, 18 Jun 2005 12:11:52 GMT</dateCreated>\r\n"); xml.Append("<dateModified>Tue, 02 Aug 2005 21:42:48 GMT</dateModified>\r\n"); xml.Append("<ownerName>fnya</ownerName>\r\n"); xml.Append("<ownerEmail>[email protected]</ownerEmail>\r\n"); xml.Append("<ownerId>http://news.com.com/</ownerId>\r\n"); xml.Append("<docs>http://news.com.com/</docs>\r\n"); xml.Append("<expansionState>1,6,13,16,18,20</expansionState>\r\n"); xml.Append("<vertScrollState>1</vertScrollState>\r\n"); xml.Append("<windowTop>106</windowTop>\r\n"); xml.Append("<windowLeft>106</windowLeft>\r\n"); xml.Append("<windowBottom>558</windowBottom>\r\n"); xml.Append("<windowRight>479</windowRight>\r\n"); xml.Append("</head>\r\n"); xml.Append("<body>\r\n"); xml.Append("<outline "); xml.Append("text=\"CNET News.com\" "); xml.Append("isComment=\"true\" "); xml.Append("isBreakpoint=\"true\" "); xml.Append("created=\"Tue, 02 Aug 2005 21:42:48 GMT\" "); xml.Append("category=\"/Harvard/Berkman,/Politics\" "); xml.Append("description=\"Tech news and business reports by CNET News.com.\" "); xml.Append("htmlUrl=\"http://news.com.com/\" "); xml.Append("language=\"unknown\" "); xml.Append("title=\"CNET News.com\" "); xml.Append("type=\"rss\" "); xml.Append("version=\"RSS2\" "); xml.Append("xmlUrl=\"http://news.com.com/2547-1_3-0-5.xml\" "); xml.Append("/>\r\n"); xml.Append("</body>\r\n"); xml.Append("</opml>"); Assert.True(opml.ToString() == xml.ToString()); }
public Production2() { head = new Head(); body = new Body2(); }
IEnumerator Schedule(Head chunk) { yield return new WaitForSeconds(chunk.Start); DebugManager.Instance.OnChunkStart(chunk); float duration = chunk.End; switch (chunk.Lexeme) { case Behaviour.Lexemes.Head.SHAKE: StartCoroutine(ShakeHead(duration, chunk.Repetition, chunk.Amount)); break; case Behaviour.Lexemes.Head.NOD: StartCoroutine(NodDown(duration, chunk.Repetition, chunk.Amount)); break; case Behaviour.Lexemes.Head.ACK: StartCoroutine(NodUp(duration, chunk.Repetition, chunk.Amount)); break; default: throw new ArgumentOutOfRangeException(); } yield return null; }
void OnPlayerEvent( Player.PlayerEvent playerEvent ) { switch ( playerEvent ) { case Player.PlayerEvent.Dispossess: cameraAnchorRootTransform = null; mainCamera.Dispossess(); break; case Player.PlayerEvent.Possess: GameObject playerParentGO = Singletons.player.charRootTransform .gameObject; head = MiscUtils.FindChildInHierarchy( playerParentGO, "Head").GetComponent<Head>(); cameraAnchorRootTransform = MiscUtils.FindChildInHierarchy( playerParentGO, "CameraAnchor_TwoPerspectives").transform; mainCamera.InitializeForNewCharacter(Singletons.player.charRootTransform); if ( state == State.FirstPerson ) mainCamera.HideHead(); break; } }
/// <summary> /// 出金操作--通联支付 /// </summary> /// <param name="setAccountName">收款方账户姓名</param> /// <param name="setAccountNo">收款方账户银行卡号</param> /// <param name="setAccountType">收款方账户类型,固定值,可取值:PERSONAL代表个人账户 ENTERPRISE代表企业账户</param> /// <param name="setAmt">金额,正整数,精确到分。例如,票款为1280元,则表示为“128000”</param> /// <param name="setBankName">收款方开户行名称(精确到支行,比如中国工商银行上海市浦东大道支行)</param> /// <param name="setBankNo">收款方开户行行号(电子联行号)可空</param> private static RequestResult allinpayMethod(string setAccountName, string setAccountNo, string setAccountType, string setAmt, string setBankName, string setBankNo) { RequestResult requesResult = new RequestResult(); // 第一步,设置环境数据 Env env = new Env(); //外网测试地址 env.setServerUrl(ConfigurationManager.AppSettings["url"]); env.setAllinfinaceCertificatePath(ConfigurationManager.AppSettings["TLCert"]); env.setMerchantCertificatePath(ConfigurationManager.AppSettings["cer"]); env.setMerchantKeyStorePath(ConfigurationManager.AppSettings["pfx"]); env.setMerchantKeyStoreType(Constant.KEY_STORE_TYPE_PKCS12); env.setMerchantKeyStorePassword(ConfigurationManager.AppSettings["password"]); //商人证书别名 env.setMerchantCertificateAlias("test"); // 第二步,设置交易数据 for (int i = 0; i < 1; i++) { AgentpayRequest request = new AgentpayRequest(); AgentpayRequestEnvelope envelope = new AgentpayRequestEnvelope(); Head head = new Head(); // 默认utf-8 head.setCharset("UTF-8"); head.setVersion("v1.0.7.1"); envelope.setHead(head); AgentpayRequestBody body = new AgentpayRequestBody(); AgentpayRequestInfo info = new AgentpayRequestInfo(); string strNo = ConfigurationManager.AppSettings["merchantId"]; info.setMchtBatchNo(strNo + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); info.setMchtId(strNo); List<IRecord> records = new List<IRecord>(); for (int ii = 0; ii < 1; ii++) { AgentpayRequestRecord record = new AgentpayRequestRecord(); record.setMchtOrderNo(strNo + "Detail-" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ii); record.setAccountName(setAccountName); record.setAccountNo(setAccountNo); record.setAccountType(setAccountType); record.setAmt(long.Parse(setAmt)); record.setBankName(setBankName); record.setBankNo(setBankNo); records.Add(record); } body.setInfo(info); body.setRecords(records); envelope.setBody(body); request.setEnvelope(envelope); Sign sign = new Sign(); sign.setSignType("1"); request.setSign(sign); // 第三步,调用支付请求服务,获得支付响应 try { AgentpayResponse response = AgentpayService.pay((IBatch)request, env); for (int j = 0; j < response.getEnvelope().getBody().getRecords().Count(); j++) { //ElementAt(j)替换get(j) AgentpayResponseRecord rr = (AgentpayResponseRecord)response.getEnvelope().getBody().getRecords().ElementAt(j); string code = rr.getResponseCode(); if (code == "E0000" || code == "R1001" || code == "R1000") { requesResult.IsSuccess = true; requesResult.ErrMsg = rr.getResponseMsg(); } else { requesResult.IsSuccess = false; requesResult.ErrMsg = rr.getResponseMsg(); } } } catch (BatchResolveException e) { requesResult.IsSuccess = false; requesResult.ErrMsg = " 异常 " + e.Message; } } return requesResult; }
public static void ChangeHead(string filepath, Commit newTarget) { Head head = new Head(newTarget); UpdateHead(filepath, head); }
/// <summary> /// Calculates the hash code for this object. /// </summary> /// <returns>The hash code.</returns> public override int GetHashCode() { return(Cylinder.GetHashCode() ^ Head.GetHashCode() ^ Sector.GetHashCode()); }
private float GetHeadingMid(Head cur, Head before) { bool isPositive = (cur.heading < 0) ? false : true; if (Math.Abs(cur.heading - before.heading) > Math.PI) { if (isPositive) before.heading += (float)(2 * Math.PI); else before.heading -= (float)(2 * Math.PI); } return (cur.heading + before.heading) / 2.0f; }
private void GenerateGridColumns() { if (this._camlXmlQuery.ViewFields == null) { return; } { if (this._head.Heads == null) { this._head.Heads = new List <Head>(); } Head settingsHeader = this._head.Heads.FirstOrDefault(); if (settingsHeader == null) { this._head.Heads.Clear(); this._head.Heads.Add(new Head { Position = "Top", ColumnGroups = new List <ColumnGroup> { new ColumnGroup { Hide = true } } }); } } // а эта колонка нужна для работы клиентского контеста и рибона this._head.Heads[0].ColumnGroups[0].Columns.Add(new ColumnProperties { FieldName = Constants.ColumnSpPrefix + "ID", Caption = "#", Visible = false, Type = SPFieldType.Text.ToString(), GroupIndex = -1 }); // а эта колонка нужна для работы клиентского контеста и рибона //this._head.Heads[0].ColumnGroups[0].Columns.Add(new ColumnProperties //{ // FieldName = "FullId", // Caption = "#", // Visible = false, // Type = SPFieldType.Text.ToString(), // GroupIndex = -1 //}); // а эта колонка нужна для ссылки на элемент bool linkIsPopupWindow = !this._spView.ParentList.NavigateForFormsPages; this._head.Heads[0].ColumnGroups[0].Columns.Add(new ColumnProperties { FieldName = "EditUrl", Caption = "#", Visible = true, Type = Enums.FieldType.AdvancedUrl.ToString(), NavigateUrlFormatString = "{0}", TextField = Constants.ColumnSpPrefix + "ID", // TextField = "FullId", LinkIsPopupWindow = linkIsPopupWindow, GroupIndex = -1 }); List <string> excludedFieldsList = new List <string> { "_CheckinComment", "_CopySource", "CheckoutUser", "AppEditor", "AppAuthor", "FileSizeDisplay", "DocIcon" }; foreach (CamlXmlFieldRef fieldRef in this._camlXmlQuery.ViewFields.FieldRef) { bool isExcledudField = excludedFieldsList.Any(excludedFieldList => String.Equals(fieldRef.Name, excludedFieldList, StringComparison.InvariantCultureIgnoreCase)); if (isExcledudField || !this._spView.ParentList.Fields.ContainsField(fieldRef.Name)) { continue; } SPField spField = this._spView.ParentList.Fields.GetField(fieldRef.Name); ColumnProperties column = new ColumnProperties { FieldName = fieldRef.Name, Caption = spField.Title, Visible = true, Type = spField.Type.ToString(), GroupIndex = -1 }; SPFieldNumber spFieldNumber = spField as SPFieldNumber; if (spFieldNumber != null && spFieldNumber.DisplayFormat != SPNumberFormatTypes.Automatic && spFieldNumber.DisplayFormat != SPNumberFormatTypes.NoDecimal) { column.DisplayFormat = "N2"; } if (this._camlXmlQuery.Query != null && this._camlXmlQuery.Query.GroupBy != null && this._camlXmlQuery.Query.GroupBy.FieldRef != null && this._camlXmlQuery.Query.GroupBy.FieldRef.Count != 0) { if (this._camlXmlQuery.Query.GroupBy.FieldRef.Any(f => f.Name == fieldRef.Name)) { int max = this._head.Heads[0].ColumnGroups[0].Columns.Max(c => c.GroupIndex); column.GroupIndex = max == 0 ? 0 : max + 1; } } if (this._camlXmlQuery.Aggregations != null && this._camlXmlQuery.Aggregations.Value == "On" && this._camlXmlQuery.Aggregations.FieldRef != null && this._camlXmlQuery.Aggregations.FieldRef.Count != 0) { foreach (CamlXmlFieldRef camlXmlFieldRef in this._camlXmlQuery.Aggregations.FieldRef) { if (camlXmlFieldRef.Name == fieldRef.Name) { column.Summary = true; column.SummaryType = this.GetSummaryType(camlXmlFieldRef.Type); column.ShowSummary = 1; } } } this._head.Heads[0].ColumnGroups[0].Columns.Add(column); } }
private Head GetHeadingMedian(ref List<Head> list) { if (list.Count == 0) { Head temp = new Head(); temp.heading = 0.0f; temp.isDistortion = false; return temp; } float init = list[0].heading; bool isPositive = true; if (init < 0) isPositive = false; int pureCount = 0; for (int i = 1; i < list.Count; i++) { if (Math.Abs(init - list[i].heading) > Math.PI) { Head temp = new Head(); if (isPositive) temp.heading = list[i].heading + (float)(2 * Math.PI); else temp.heading = list[i].heading - (float)(2 * Math.PI); temp.isDistortion = list[i].isDistortion; list.RemoveAt(i); list.Insert(i, temp); } if (list[i].isDistortion == false) pureCount++; } if(pureCount == 0) { list.Sort(delegate(Head h1, Head h2) { return h1.heading.CompareTo(h2.heading); }); return list[list.Count / 2]; } else { for(int i=0 ; i < list.Count; i++) { if (list[i].isDistortion) { list.RemoveAt(i); i--; } } list.Sort(delegate(Head h1, Head h2) { return h1.heading.CompareTo(h2.heading); }); return list[list.Count / 2]; } }
private float GetHeadingDifference(Head cur, float before) { bool isPositive = (cur.heading < 0) ? false : true; if (Math.Abs(cur.heading - before) > Math.PI) { if (isPositive) before += (float)(2 * Math.PI); else before -= (float)(2 * Math.PI); } return Math.Abs(cur.heading - before); }
public override Expression CloneExpression() { return(new MkSequence(DataType, Head.CloneExpression(), Tail.CloneExpression())); }
public MessageOLD(Head h, string s) { this.mssg[0] = (byte)h; this.mssg = MessageOLD.ToByteArray(s); }
public DeviceStateEntity() { meta = new Head(); body = new Body(); }
public Cracker() : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4) { Name = NameList.RandomName("male"); Title = "The vicious murderer"; Body = 0x190; Kills = 5; Hue = Utility.RandomSkinHue(); SetStr(276, 350); SetDex(150, 200); SetInt(126, 150); SetHits(350, 400); SetDamage(11, 14); SetResistance(ResistanceType.Physical, 5); SetDamageType(ResistanceType.Physical, 100); SetSkill(SkillName.Tactics, 80.1, 100.0); SetSkill(SkillName.MagicResist, 100.1, 110.0); SetSkill(SkillName.Anatomy, 80.1, 100.0); SetSkill(SkillName.Healing, 80.1, 100.0); SetSkill(SkillName.Fencing, 85.1, 100); Fame = 9000; Karma = -15000; PackItem(new Apple(Utility.RandomMinMax(3, 5))); PackItem(new Bandage(Utility.RandomMinMax(15, 55))); CrackerDagger chd = new CrackerDagger(); chd.Crafter = this; chd.Name = this.Name + "'s Dagger"; CrackerBuckler chb = new CrackerBuckler(); chb.Crafter = this; chb.Name = this.Name + "'s Buckler"; if (0.5 > Utility.RandomDouble()) { AddItem(chd); } else { AddItem(new Dagger()); } if (0.10 > Utility.RandomDouble()) { AddItem(chb); } else { AddItem(new Buckler()); } //if (0.15 > Utility.RandomDouble()) // AddItem(new RandomAddonTicket()); //m_Timer = new InternalTimer( this ); //m_Timer.Start(); //CraftResource res = CraftResource.None;; //switch (Utility.Random(4)) //{ // case 0: res = CraftResource.RegularLeather; break; // case 1: res = CraftResource.SpinedLeather; break; // case 2: res = CraftResource.HornedLeather; break; // case 3: res = CraftResource.BarbedLeather; break; //} //if (0.05 > Utility.RandomDouble()) // AddItem(new RunicSewingKit(res, Utility.RandomMinMax(1, 5))); //else // AddItem(new SewingKit()); LeatherChest Tunic = new LeatherChest(); Tunic.ItemID = 9859; Tunic.Name = "Leather Hood Robe"; Tunic.Layer = Layer.OuterTorso; //Tunic.Resource = res; Tunic.Movable = false; Tunic.Quality = ArmorQuality.Exceptional; Tunic.Crafter = this; AddItem(Tunic); LeatherLegs Legs = new LeatherLegs(); //Legs.Resource = res; Legs.Movable = false; AddItem(Legs); Boots boot = new Boots(); //boot.Resource = res; boot.Movable = false; AddItem(boot); LeatherArms Arms = new LeatherArms(); //Arms.Resource = res; Arms.Movable = false; AddItem(Arms); LeatherGloves Gloves = new LeatherGloves(); //Gloves.Resource = res; Gloves.Movable = false; Gloves.Quality = ArmorQuality.Exceptional; Gloves.Crafter = this; AddItem(Gloves); LeatherCap Helm = new LeatherCap(); //Helm.Resource = res; Helm.Movable = false; Helm.Quality = ArmorQuality.Exceptional; Helm.Crafter = this; AddItem(Helm); Head hd = new Head(); hd.Name = "the head of " + NameList.RandomName("male"); AddItem(hd); //EtherealOstard mt = new EtherealOstard(); //mt.Hue = Utility.RandomNeutralHue(); //mt.Movable = false; //mt.Rider = this; }
public AccessEntity() { meta = new Head(); body = new Body(); }
public Biped(World w, Vec2 position) { _world = w; BipedDef def = new BipedDef(); BodyDef bd = new BodyDef(); // create body parts bd = def.LFootDef; bd.Position += position; LFoot = w.CreateBody(bd); LFoot.CreateShape(def.LFootPoly); LFoot.SetMassFromShapes(); bd = def.RFootDef; bd.Position += position; RFoot = w.CreateBody(bd); RFoot.CreateShape(def.RFootPoly); RFoot.SetMassFromShapes(); bd = def.LCalfDef; bd.Position += position; LCalf = w.CreateBody(bd); LCalf.CreateShape(def.LCalfPoly); LCalf.SetMassFromShapes(); bd = def.RCalfDef; bd.Position += position; RCalf = w.CreateBody(bd); RCalf.CreateShape(def.RCalfPoly); RCalf.SetMassFromShapes(); bd = def.LThighDef; bd.Position += position; LThigh = w.CreateBody(bd); LThigh.CreateShape(def.LThighPoly); LThigh.SetMassFromShapes(); bd = def.RThighDef; bd.Position += position; RThigh = w.CreateBody(bd); RThigh.CreateShape(def.RThighPoly); RThigh.SetMassFromShapes(); bd = def.PelvisDef0; bd.Position += position; Pelvis = w.CreateBody(bd); Pelvis.CreateShape(def.PelvisPoly); Pelvis.SetMassFromShapes(); bd = def.PelvisDef; bd.Position += position; Stomach = w.CreateBody(bd); Stomach.CreateShape(def.StomachPoly); Stomach.SetMassFromShapes(); bd = def.ChestDef; bd.Position += position; Chest = w.CreateBody(bd); Chest.CreateShape(def.ChestPoly); Chest.SetMassFromShapes(); bd = def.NeckDef; bd.Position += position; Neck = w.CreateBody(bd); Neck.CreateShape(def.NeckPoly); Neck.SetMassFromShapes(); bd = def.HeadDef; bd.Position += position; Head = w.CreateBody(bd); Head.CreateShape(def.HeadCirc); Head.SetMassFromShapes(); bd = def.LUpperArmDef; bd.Position += position; LUpperArm = w.CreateBody(bd); LUpperArm.CreateShape(def.LUpperArmPoly); LUpperArm.SetMassFromShapes(); bd = def.RUpperArmDef; bd.Position += position; RUpperArm = w.CreateBody(bd); RUpperArm.CreateShape(def.RUpperArmPoly); RUpperArm.SetMassFromShapes(); bd = def.LForearmDef; bd.Position += position; LForearm = w.CreateBody(bd); LForearm.CreateShape(def.LForearmPoly); LForearm.SetMassFromShapes(); bd = def.RForearmDef; bd.Position += position; RForearm = w.CreateBody(bd); RForearm.CreateShape(def.RForearmPoly); RForearm.SetMassFromShapes(); bd = def.LHandDef; bd.Position += position; LHand = w.CreateBody(bd); LHand.CreateShape(def.LHandPoly); LHand.SetMassFromShapes(); bd = def.RHandDef; bd.Position += position; RHand = w.CreateBody(bd); RHand.CreateShape(def.RHandPoly); RHand.SetMassFromShapes(); // link body parts def.LAnkleDef.Body1 = LFoot; def.LAnkleDef.Body2 = LCalf; def.RAnkleDef.Body1 = RFoot; def.RAnkleDef.Body2 = RCalf; def.LKneeDef.Body1 = LCalf; def.LKneeDef.Body2 = LThigh; def.RKneeDef.Body1 = RCalf; def.RKneeDef.Body2 = RThigh; def.LHipDef.Body1 = LThigh; def.LHipDef.Body2 = Pelvis; def.RHipDef.Body1 = RThigh; def.RHipDef.Body2 = Pelvis; def.LowerAbsDef.Body1 = Pelvis; def.LowerAbsDef.Body2 = Stomach; def.UpperAbsDef.Body1 = Stomach; def.UpperAbsDef.Body2 = Chest; def.LowerNeckDef.Body1 = Chest; def.LowerNeckDef.Body2 = Neck; def.UpperNeckDef.Body1 = Chest; def.UpperNeckDef.Body2 = Head; def.LShoulderDef.Body1 = Chest; def.LShoulderDef.Body2 = LUpperArm; def.RShoulderDef.Body1 = Chest; def.RShoulderDef.Body2 = RUpperArm; def.LElbowDef.Body1 = LForearm; def.LElbowDef.Body2 = LUpperArm; def.RElbowDef.Body1 = RForearm; def.RElbowDef.Body2 = RUpperArm; def.LWristDef.Body1 = LHand; def.LWristDef.Body2 = LForearm; def.RWristDef.Body1 = RHand; def.RWristDef.Body2 = RForearm; // create joints LAnkle = (RevoluteJoint)w.CreateJoint(def.LAnkleDef); RAnkle = (RevoluteJoint)w.CreateJoint(def.RAnkleDef); LKnee = (RevoluteJoint)w.CreateJoint(def.LKneeDef); RKnee = (RevoluteJoint)w.CreateJoint(def.RKneeDef); LHip = (RevoluteJoint)w.CreateJoint(def.LHipDef); RHip = (RevoluteJoint)w.CreateJoint(def.RHipDef); LowerAbs = (RevoluteJoint)w.CreateJoint(def.LowerAbsDef); UpperAbs = (RevoluteJoint)w.CreateJoint(def.UpperAbsDef); LowerNeck = (RevoluteJoint)w.CreateJoint(def.LowerNeckDef); UpperNeck = (RevoluteJoint)w.CreateJoint(def.UpperNeckDef); LShoulder = (RevoluteJoint)w.CreateJoint(def.LShoulderDef); RShoulder = (RevoluteJoint)w.CreateJoint(def.RShoulderDef); LElbow = (RevoluteJoint)w.CreateJoint(def.LElbowDef); RElbow = (RevoluteJoint)w.CreateJoint(def.RElbowDef); LWrist = (RevoluteJoint)w.CreateJoint(def.LWristDef); RWrist = (RevoluteJoint)w.CreateJoint(def.RWristDef); }
public DeviceResourEntity() { meta = new Head(); body = new Body(); }
private void ReadSensorData() { try { while(readFlag) { // MotionNode Data Handling if(motionUse) { bool rawGet = false; if(motionRaw.waitForData()) { byte[] rawBuffer = motionRaw.readData(); if(rawBuffer != null) { IDictionary<int, MotionNode.SDK.Format.RawElement> rawMotion = MotionNode.SDK.Format.Raw(rawBuffer); foreach (KeyValuePair<int, MotionNode.SDK.Format.RawElement> itr in rawMotion) { x.UpdateMotionAccelRaw(itr.Value.getAccelerometer()[0]); y.UpdateMotionAccelRaw(itr.Value.getAccelerometer()[1]); z.UpdateMotionAccelRaw(itr.Value.getAccelerometer()[2]); if (trainingFlag) mAccelRawY.Add(itr.Value.getAccelerometer()[1]); rawGet = true; this.Invoke(new MethodInvoker(delegate() { this.mAccRawX.Text = x.GetMotionAccelRaw().ToString(); this.mAccRawY.Text = y.GetMotionAccelRaw().ToString(); this.mAccRawZ.Text = z.GetMotionAccelRaw().ToString(); this.mAccX.Text = x.GetMotionAccel().ToString(); this.mAccY.Text = y.GetMotionAccel().ToString(); this.mAccZ.Text = z.GetMotionAccel().ToString(); this.mAccDevX.Text = x.mAccRawDev.ToString(); this.mAccDevY.Text = y.mAccRawDev.ToString(); this.mAccDevZ.Text = z.mAccRawDev.ToString(); this.mAccAvgX.Text = x.mAccAvg.ToString(); this.mAccAvgY.Text = y.mAccAvg.ToString(); this.mAccAvgZ.Text = z.mAccAvg.ToString(); })); } } } if(rawGet && motionPreview.waitForData()) { byte[] previewBuffer = motionPreview.readData(); if(previewBuffer != null) { IDictionary<int, MotionNode.SDK.Format.PreviewElement> previewMotion = MotionNode.SDK.Format.Preview(previewBuffer); foreach (KeyValuePair<int, MotionNode.SDK.Format.PreviewElement> itr in previewMotion) { float temp = itr.Value.getEuler()[0] - (float)(Math.PI / 6.0f); if (temp < -Math.PI) temp += (float)(2 * Math.PI); x.UpdateMotionEuler(temp); //x.UpdateMotionEuler(itr.Value.getEuler()[0]); } } } if(rawGet && motionSensor.waitForData()) { byte[] sensorBuffer = motionSensor.readData(); if(sensorBuffer != null) { IDictionary<int, MotionNode.SDK.Format.SensorElement> sensorMotion = MotionNode.SDK.Format.Sensor(sensorBuffer); foreach (KeyValuePair<int, MotionNode.SDK.Format.SensorElement> itr in sensorMotion) { x.UpdateMotionAccel(itr.Value.getAccelerometer()[0]); y.UpdateMotionAccel(itr.Value.getAccelerometer()[1]); z.UpdateMotionAccel(itr.Value.getAccelerometer()[2]); x.UpdateMotionMag(itr.Value.getMagnetometer()[0]); y.UpdateMotionMag(itr.Value.getMagnetometer()[1]); z.UpdateMotionMag(itr.Value.getMagnetometer()[2]); z.mUpdateAngle(ref y, ref x); y.mUpdateAngle(ref z, ref x); } mUpdateHeading(ref z, ref y); mUpdateTiltHeading(ref z, ref y, ref x); /* if (x.mAccStop && y.mAccStop && z.mAccStop) { if(mMoving) { posLog.WriteLine("Stop Position"); } //x.SetMotionVelocityZero(); //y.SetMotionVelocityZero(); z.SetMotionVelocityZero(); //mUpdateHeading(ref z, ref y); mMoving = false; movingCount = 0; movingMin = 4096; movingMax = 0; movingDirection = -1; movingDistance = 0.0f; movingDistanceR = 0.0f; movingVibe = 0; movingDev = 0.0f; movingDevMax = 0.0f; movingStep++; peakChangeX = 0; peakChangeY = 0; peakChangeZ = 0; mMovingTiltHeadingSum = 0.0f; stepState = 0; stepInterval = 0; stepCount = 0; oneStepSampleCount = 0; oneStepVariance = 0.0f; } */ //if (!x.mAccStop || !y.mAccStop || !z.mAccStop) //{ stepInterval++; movingCount++; //mTiltHeadingAvgBeforeMoving = mTiltHeadingAvg; //mUpdateMovingTiltHeading(ref z, ref y, ref x); //x.UpdateMotionPosition(); //y.UpdateMotionPosition(); //z.UpdateMotionPosition(); //z.UpdateMotionPositionR(); //z.UpdateMotionPositionRRaw(); //x_diff = z.mGetPositionDiff(); //xR_diff = z.mGetPositionRDiff(); //x_diff = z.mGetPositionRRawDiff(); //x_diff = Math.Abs(x_diff); //xR_diff = Math.Abs(xR_diff); //UpdateWorldPosition(x_diff, mHeadingAvg, ref xc, ref yc, ref stageIndex); //UpdateWorldPosition(xR_diff, mTiltHeadingAvg * (1-MOVING_HEAD_WEIGHT) + mMovingTiltHeadingAvg * (MOVING_HEAD_WEIGHT), ref xc_tilt, ref yc_tilt, ref stageIndex_tilt); //UpdateWorldPosition(xR_diff, mHeadingAvg, ref xcR, ref ycR, ref stageIndexR); //UpdateWorldPosition(xR_diff, mTiltHeadingAvg, ref xcR_tilt, ref ycR_tilt, ref stageIndexR_tilt); //movingDistanceR += xR_diff; //UpdateWorldPosition(x_diff, mTiltHeadingAvg, ref xc_tilt, ref yc_tilt, ref stageIndex_tilt); //movingDistance += x_diff; //int temp = z.GetMotionAccelDirection(); //if (peakDirectionZ != temp) //{ // peakAccelRawZ = z.GetMotionAccelPeakRaw(); // peakAccelZ = z.GetMotionAccelPeak(); // peakFlagZ = 1; // peakChangeZ++; //} //else // peakFlagZ = 0; //peakDirectionZ = temp; //temp = x.GetMotionAccelDirection(); //if (peakDirectionX != temp) //{ // peakAccelRawX = x.GetMotionAccelPeakRaw(); // peakAccelX = x.GetMotionAccelPeak(); // peakFlagX = 1; // peakChangeX++; //} //else // peakFlagX = 0; //peakDirectionX = temp; if(stepState == 1 && stepInterval > STEP_TIME) { stepState = 0; stepInterval = 0; } int temp = y.GetMotionAccelDirection(); if (peakDirectionY != temp) { peakAccelRawY = y.GetMotionAccelPeakRaw(); peakAccelY = y.GetMotionAccelPeak(); peakFlagY = 1; peakChangeY++; } else peakFlagY = 0; peakDirectionY = temp; int val_accel = y.GetMotionAccelRaw(); float val_accel_g = y.GetMotionAccel(); Head val_head = new Head(); Head val_head_raw = new Head(); Head val_head_s = new Head(); Head val_head_e = new Head(); val_head.heading = GetTiltHeading(); val_head.isDistortion = GetDistortion(x.mGetMag(), y.mGetMag(), z.mGetMag()); val_head_raw.heading = GetHeading(); val_head_raw.isDistortion = GetDistortion(x.mGetMag(), y.mGetMag(), z.mGetMag()); val_head_s.heading = GetTiltHeadingSecond(); val_head_s.isDistortion = GetDistortion(x.mGetMag(), y.mGetMag(), z.mGetMag()); val_head_e.heading = x.GetMotionEuler(); val_head_e.isDistortion = GetDistortion(x.mGetMag(), y.mGetMag(), z.mGetMag()); switch (stepState) { case 0: oneStepSampleCount = 0; oneStepRaw.Clear(); oneStepAcc.Clear(); mStanceState = 0; mStanceRaw.Add(val_accel); mStanceRawSum += val_accel; mStanceRawSquareSum += val_accel * val_accel; mStanceHead.Add(val_head); if (mStanceHead.Count > STANCE_WINDOW) mStanceHead.RemoveAt(0); mStanceHeadTest.Add(val_head_raw); if (mStanceHeadTest.Count > STANCE_WINDOW) mStanceHeadTest.RemoveAt(0); mStanceHeadSecond.Add(val_head_s); if (mStanceHeadSecond.Count > STANCE_WINDOW) mStanceHeadSecond.RemoveAt(0); mStanceHeadEuler.Add(val_head_e); if (mStanceHeadEuler.Count > STANCE_WINDOW) mStanceHeadEuler.RemoveAt(0); if(mStanceRaw.Count > STANCE_WINDOW) { mStanceRawSum -= mStanceRaw[0]; mStanceRawSquareSum -= mStanceRaw[0] * mStanceRaw[0]; mStanceRaw.RemoveAt(0); mStanceStdev = (float)Math.Sqrt((float)mStanceRawSquareSum / STANCE_WINDOW - ((float)mStanceRawSum / STANCE_WINDOW) * ((float)mStanceRawSum / STANCE_WINDOW)); if(mStanceStdev < 100.0f) { mStanceState = 1; mStanceHeadAvgList.Add(GetHeadingMedian(ref mStanceHead)); if (mStanceHeadAvgList.Count > ZUPT_WINDOW) mStanceHeadAvgList.RemoveAt(0); mStanceHeadAvgListTest.Add(GetHeadingMedian(ref mStanceHeadTest)); if (mStanceHeadAvgListTest.Count > ZUPT_WINDOW) mStanceHeadAvgListTest.RemoveAt(0); mStanceHeadAvgListSecond.Add(GetHeadingMedian(ref mStanceHeadSecond)); if (mStanceHeadAvgListSecond.Count > ZUPT_WINDOW) mStanceHeadAvgListSecond.RemoveAt(0); mStanceHeadAvgListEuler.Add(GetHeadingMedian(ref mStanceHeadEuler)); if (mStanceHeadAvgListEuler.Count > ZUPT_WINDOW) mStanceHeadAvgListEuler.RemoveAt(0); stanceCount++; } } if (peakFlagY == 1 && temp == 1 && stepInterval >= 0) { if(peakAccelRawY <= lowerBound) { stepState = 1; stepInterval = 0; oneStepSampleCount++; if (mStanceHeadAvgList.Count > 0) { float mid_head = 0.0f; float diff_head = 0.0f; // 스텝 카운트 stepCount++; if (rand.NextDouble() >= 0.5) x_diff = 2.0f * (float)(AVG_STEP + DEV_STEP * rand.NextDouble()); else x_diff = 2.0f * (float)(AVG_STEP - DEV_STEP * rand.NextDouble()); movingDistance += x_diff; mBeforeStanceHeadAvg = mStanceHeadAvg; mBeforeStanceHeadAvgEuler = mStanceHeadAvgEuler; mBeforeStanceHeadAvgSecond = mStanceHeadAvgSecond; mBeforeStanceHeadAvgTest = mStanceHeadAvgTest; if (mStanceHeadAvg.isDistortion == false) mLastPureStanceHeadAvg = mStanceHeadAvg; if (mStanceHeadAvgEuler.isDistortion == false) mLastPureStanceHeadAvgEuler = mStanceHeadAvgEuler; if (mStanceHeadAvgTest.isDistortion == false) mLastPureStanceHeadAvgTest = mStanceHeadAvgTest; if (mStanceHeadAvgSecond.isDistortion == false) mLastPureStanceHeadAvgSecond = mStanceHeadAvgSecond; mStanceHeadAvg = GetHeadingMedian(ref mStanceHeadAvgList); mStanceHeadAvgTest = GetHeadingMedian(ref mStanceHeadAvgListTest); mStanceHeadAvgSecond = GetHeadingMedian(ref mStanceHeadAvgListSecond); mStanceHeadAvgEuler = GetHeadingMedian(ref mStanceHeadAvgListEuler); mStanceHeadAvg = CheckOverflow(mStanceHeadAvg, mBeforeStanceHeadAvg); mStanceHeadAvgTest = CheckOverflow(mStanceHeadAvgTest, mBeforeStanceHeadAvgTest); mStanceHeadAvgSecond = CheckOverflow(mStanceHeadAvgSecond, mBeforeStanceHeadAvgSecond); mStanceHeadAvgEuler = CheckOverflow(mStanceHeadAvgEuler, mBeforeStanceHeadAvgEuler); mid_head = GetHeadingMid(mStanceHeadAvgEuler, mBeforeStanceHeadAvgEuler); UpdateWorldPosition(x_diff, mid_head, ref xcR, ref ycR, ref stageIndexR); UpdateWorldPosition(x_diff, mid_head, ref xcM, ref ycM, ref stageIndexM); diff_head = GetHeadingDifference(mStanceHeadAvgEuler, mid_head); movingDistanceErrorEuler += (float)(2 * x_diff * Math.Sin(diff_head / 2.0f)); movingDistanceErrorM += (float)(2 * x_diff * Math.Sin(diff_head / 2.0f)); p_euler = (float)(GRID * GRID) / (float)(movingDistanceErrorEuler * movingDistanceErrorEuler * Math.PI); p_m = (float)(GRID * GRID) / (float)(movingDistanceErrorM * movingDistanceErrorM * Math.PI); p_euler = (p_euler > 1.0f) ? 1.0f : p_euler; p_m = (p_m > 1.0f) ? 1.0f : p_m; mid_head = GetHeadingMid(mStanceHeadAvgEuler, mLastPureStanceHeadAvgEuler); UpdateWorldPosition(x_diff, mid_head, ref xc_tilt, ref yc_tilt, ref stageIndex_tilt); UpdateWorldPosition(x_diff, mid_head, ref xcR_tilt, ref ycR_tilt, ref stageIndexR_tilt); diff_head = GetHeadingDifference(mStanceHeadAvgEuler, mid_head); movingDistanceErrorEulerD += (float)(2 * x_diff * Math.Sin(diff_head / 2.0f)); movingDistanceErrorMD += (float)(2 * x_diff * Math.Sin(diff_head / 2.0f)); pd_euler = (float)(GRID * GRID) / (float)(movingDistanceErrorEulerD * movingDistanceErrorEulerD * Math.PI); pd_m = (float)(GRID * GRID) / (float)(movingDistanceErrorMD * movingDistanceErrorMD * Math.PI); pd_euler = (pd_euler > 1.0f) ? 1.0f : pd_euler; pd_m = (pd_m > 1.0f) ? 1.0f : pd_m; mid_head = GetHeadingMid(mStanceHeadAvg, mLastPureStanceHeadAvg); UpdateWorldPosition(x_diff, mid_head, ref xc, ref yc, ref stageIndex); diff_head = GetHeadingDifference(mStanceHeadAvg, mid_head); movingDistanceErrorD += (float)(2 * x_diff * Math.Sin(diff_head / 2.0f)); pd = (float)(GRID * GRID) / (float)(movingDistanceErrorD * movingDistanceErrorD * Math.PI); pd = (pd > 1.0f) ? 1.0f : pd; posLog.WriteLine("One Step"); if (sendFlag) { int bM = (stageIndexR_tilt - 1 < 0) ? (stageSize + (stageIndexR_tilt - 1)) : (stageIndexR_tilt - 1); int bbM = (stageIndexR_tilt - 2 < 0) ? (stageSize + (stageIndexR_tilt - 2)) : (stageIndexR_tilt - 2); int curX = (int)(xcR_tilt[bM]); int curY = (int)(ycR_tilt[bM]); int beforeX = (int)(xcR_tilt[bbM]); int beforeY = (int)(ycR_tilt[bbM]); if (curX != beforeX || curY != beforeY) { string sendMsg = curX.ToString() + "," + curY.ToString() + "," + movingDistanceErrorMD.ToString(); SendMessage("WifiLoc", sendMsg, 1); } } } mStanceHeadAvgList.Clear(); mStanceHeadAvgListTest.Clear(); mStanceHeadAvgListSecond.Clear(); mStanceHeadAvgListEuler.Clear(); oneStepRaw.Add(val_accel); oneStepAcc.Add(val_accel_g); } } break; case 1: mStanceState = 0; oneStepSampleCount++; oneStepRaw.Add(val_accel); oneStepAcc.Add(val_accel_g); if (peakFlagY == 1 && temp == 1 && peakAccelRawY <= lowerBound) { stepInterval = 0; } else if (peakFlagY == 1 && temp == 2 && peakAccelRawY >= upperBound) { stepState = 2; stepInterval = 0; } break; case 2: mStanceState = 0; oneStepSampleCount++; oneStepRaw.Add(val_accel); oneStepAcc.Add(val_accel_g); mStanceRaw.Add(val_accel); mStanceRawSum += val_accel; mStanceRawSquareSum += val_accel * val_accel; mStanceHead.Add(val_head); if (mStanceHead.Count > STANCE_WINDOW) mStanceHead.RemoveAt(0); mStanceHeadTest.Add(val_head_raw); if(mStanceHeadTest.Count > STANCE_WINDOW) mStanceHeadTest.RemoveAt(0); mStanceHeadSecond.Add(val_head_s); if (mStanceHeadSecond.Count > STANCE_WINDOW) mStanceHeadSecond.RemoveAt(0); mStanceHeadEuler.Add(val_head_e); if (mStanceHeadEuler.Count > STANCE_WINDOW) mStanceHeadEuler.RemoveAt(0); if (mStanceRaw.Count > STANCE_WINDOW) { mStanceRawSum -= mStanceRaw[0]; mStanceRawSquareSum -= mStanceRaw[0] * mStanceRaw[0]; mStanceRaw.RemoveAt(0); mStanceStdev = (float)Math.Sqrt((float)mStanceRawSquareSum / STANCE_WINDOW - ((float)mStanceRawSum / STANCE_WINDOW) * ((float)mStanceRawSum / STANCE_WINDOW)); if (mStanceStdev < 100.0f) { mStanceHeadAvgList.Add(GetHeadingMedian(ref mStanceHead)); mStanceHeadAvgListTest.Add(GetHeadingMedian(ref mStanceHeadTest)); mStanceHeadAvgListSecond.Add(GetHeadingMedian(ref mStanceHeadSecond)); mStanceHeadAvgListEuler.Add(GetHeadingMedian(ref mStanceHeadEuler)); stepState = 0; mStanceState = 1; oneStepSampleCount -= STANCE_WINDOW; int temp_count = 0; float temp_sum = 0.0f, temp_square_sum = 0.0f; for (int i = 0; i < oneStepRaw.Count - STANCE_WINDOW; i++) { temp_count++; temp_sum += oneStepRaw[i]; temp_square_sum += oneStepRaw[i] * oneStepRaw[i]; } oneStepVariance = (float)Math.Sqrt(temp_square_sum / temp_count - (temp_sum / temp_count) * (temp_sum / temp_count)); oneStepRaw.Clear(); temp_count = 0; temp_sum = 0.0f; temp_square_sum = 0.0f; for (int i = 0; i < oneStepAcc.Count - STANCE_WINDOW; i++) { temp_count++; temp_sum += oneStepAcc[i]; temp_square_sum += oneStepAcc[i] * oneStepAcc[i]; } oneStepAccVariance = (float)Math.Sqrt(temp_square_sum / temp_count - (temp_sum / temp_count) * (temp_sum / temp_count)); oneStepAcc.Clear(); } } break; } if (mStanceState == 1) { stanceCount++; if (stanceCount >= 64) stopFlag = true; } else { stanceCount = 0; stopFlag = false; } //movingMin = Math.Min(movingMin, z.GetMotionAccelRaw()); //movingMax = Math.Max(movingMax, z.GetMotionAccelRaw()); //movingDev = z.GetMotionAccelDev(); //movingDevMax = Math.Max(movingDevMax, movingDev); //mMoving = true; //int curD; //if (z.GetMotionAccel() > z.mAccAvg) // curD = 1; //else // curD = 0; //if (curD != movingDirection) // movingVibe++; //movingDirection = curD; if (logFlag) { //x.WriteMotionLog(log, "MotionX", mHeading); //y.WriteMotionLog(log, "MotionY", mHeading); //z.WriteMotionLog(log, "MotionZ", mHeading); int bb = stageIndex - 1; if(bb < 0) bb = stageSize - 1; int bb_tilt = stageIndex_tilt - 1; if (bb_tilt < 0) bb_tilt = stageSize - 1; int bbM = (stageIndexM - 1 < 0) ? (stageSize + (stageIndexM - 1)) : (stageIndexM - 1); int bbR = (stageIndexR - 1 < 0) ? (stageSize + (stageIndexR - 1)) : (stageIndexR - 1); int bbR_tilt = (stageIndexR_tilt - 1 < 0) ? (stageSize + (stageIndexR_tilt - 1)) : (stageIndexR_tilt - 1); int bbb_heading = (mTiltHeadingIndexSecond - 1 < 0) ? (mHeadSize - 1) : (mTiltHeadingIndexSecond - 1); int bb_heading = (mHeadingIndex - 1 < 0) ? (mHeadSize - 1) : (mHeadingIndex - 1); int b_heading = (mTiltHeadingIndex - 1 < 0) ? (mHeadSize - 1) : (mTiltHeadingIndex - 1); posLog.WriteLine(DateTime.Now.ToString() + "," + xc_tilt[bb_tilt].ToString() + "," + yc_tilt[bb_tilt].ToString() + "," + xcR_tilt[bbR_tilt].ToString() + "," + ycR_tilt[bbR_tilt].ToString() + "," + xc[bb].ToString() + "," + yc[bb].ToString() + "," + xcR[bbR].ToString() + "," + ycR[bbR].ToString() + "," + xcM[bbM].ToString() + "," + ycM[bbM].ToString() + "," + //이동거리 movingDistance.ToString() + "," + //오차거리 movingDistanceErrorEulerD.ToString() + "," + movingDistanceErrorMD.ToString() + "," + movingDistanceErrorD.ToString() + "," + movingDistanceErrorEuler.ToString() + "," + movingDistanceErrorM.ToString() + "," + //신뢰도 pd_euler.ToString() + "," + pd_m.ToString() + "," + pd.ToString() + "," + p_euler.ToString() + "," + p_m.ToString() + "," + stepState.ToString() + "," + stepCount.ToString() + "," + stepInterval.ToString() + "," + oneStepSampleCount.ToString() + "," + oneStepVariance.ToString() + "," + oneStepAccVariance.ToString() + "," + mStanceState.ToString() + "," + stopFlag.ToString() + "," + mStanceStdev.ToString() + "," + GetDistortion(x.mGetMag(), y.mGetMag(), z.mGetMag()).ToString() + "," + (mStanceHeadAvg.heading * 180.0f / Math.PI).ToString() + "," + (mStanceHeadAvgSecond.heading * 180.0f / Math.PI).ToString() + "," + (mStanceHeadAvgTest.heading * 180.0f / Math.PI).ToString() + "," + (mStanceHeadAvgEuler.heading * 180.0f / Math.PI).ToString() + "," + (mStanceHeadAvg.isDistortion).ToString() + "," + (mStanceHeadAvgSecond.isDistortion).ToString() + "," + (mStanceHeadAvgTest.isDistortion).ToString() + "," + (mStanceHeadAvgEuler.isDistortion).ToString() + "," + (mBeforeStanceHeadAvg.heading * 180.0f / Math.PI).ToString() + "," + (mBeforeStanceHeadAvgSecond.heading * 180.0f / Math.PI).ToString() + "," + (mBeforeStanceHeadAvgTest.heading * 180.0f / Math.PI).ToString() + "," + (mBeforeStanceHeadAvgEuler.heading * 180.0f / Math.PI).ToString() + "," + (mLastPureStanceHeadAvg.heading * 180.0f / Math.PI).ToString() + "," + (mLastPureStanceHeadAvgSecond.heading * 180.0f / Math.PI).ToString() + "," + (mLastPureStanceHeadAvgTest.heading * 180.0f / Math.PI).ToString() + "," + (mLastPureStanceHeadAvgEuler.heading * 180.0f / Math.PI).ToString() + "," + y.GetMotionAccelRaw().ToString() + "," + peakChangeY.ToString() + "," + peakFlagY.ToString() + "," + peakDirectionY.ToString() + "," + peakAccelRawY.ToString() + "," + peakAccelY.ToString() + "," + x.GetMotionAccelRaw().ToString() + "," + z.GetMotionAccelRaw().ToString() + "," + x.GetMotionAccel().ToString() + "," + y.GetMotionAccel().ToString() + "," + z.GetMotionAccel().ToString() + "," + x.mGetMag().ToString() + "," + y.mGetMag().ToString() + "," + z.mGetMag() + "," + (mHeadingAvg * 180.0f / Math.PI).ToString() + "," + (mHeading[bb_heading] * 180.0f / Math.PI).ToString() + "," + (mTiltHeadingAvg * 180.0f / Math.PI).ToString() + "," + (mTiltHeading[b_heading] * 180.0f / Math.PI).ToString() + "," + (mTiltHeadingAvgSecond * 180.0f / Math.PI).ToString() + "," + (mTiltHeadingSecond[bbb_heading] * 180.0f / Math.PI).ToString() + "," + (z.mGetAngle() * 180.0f / Math.PI).ToString() + "," + (y.mGetAngle() * 180.0f / Math.PI).ToString()); } //} this.Invoke(new MethodInvoker(delegate() { this.mMagX.Text = x.mGetMag().ToString(); this.mMagY.Text = y.mGetMag().ToString(); this.mMagZ.Text = z.mGetMag().ToString(); this.mAccPosX.Text = movingDistance.ToString(); this.mAccPosY.Text = (GetHeading() * 180.0f / Math.PI).ToString(); this.mAccPosZ.Text = (GetTiltHeadingSecond() * 180.0f / Math.PI).ToString(); this.mHead.Text = (GetTiltHeading() * 180.0f / Math.PI).ToString(); this.mHeadTilt.Text = (x.GetMotionEuler() * 180.0f / Math.PI).ToString(); this.mHeadStep.Text = (mStanceHeadAvg.heading * 180.0f / Math.PI).ToString(); this.mHeadStepTilt.Text = (mStanceHeadAvgEuler.heading * 180.0f / Math.PI).ToString(); int b = stageIndex - 1; if(b < 0) b = stageSize - 1; this.mStageX.Text = (xc[b]).ToString(); this.mStageY.Text = (yc[b]).ToString(); b = (stageIndexM - 1 < 0) ? (stageSize - 1) : (stageIndexM - 1); this.mStageMX.Text = (xcM[b]).ToString(); this.mStageMY.Text = (ycM[b]).ToString(); b = (stageIndexR - 1 < 0) ? (stageSize + (stageIndexR - 1)) : (stageIndexR - 1); this.mStageRX.Text = (xcR_tilt[b]).ToString(); this.mStageRY.Text = (ycR_tilt[b]).ToString(); //this.mError.Text = movingDistanceError.ToString(); //this.mErrorTest.Text = movingDistanceErrorTest.ToString(); this.mErrorEuler.Text = movingDistanceErrorEuler.ToString(); this.mErrorM.Text = movingDistanceErrorM.ToString(); this.mErrorD.Text = movingDistanceErrorD.ToString(); //this.mErrorTestD.Text = movingDistanceErrorTestD.ToString(); this.mErrorEulerD.Text = movingDistanceErrorEulerD.ToString(); this.mErrorMD.Text = movingDistanceErrorMD.ToString(); this.mRoll.Text = (y.mGetAngle() * 180.0f / Math.PI).ToString(); this.mPitch.Text = (z.mGetAngle() * 180.0f / Math.PI).ToString(); this.StepCountLabel.Text = stepCount.ToString(); this.StepIntervalLabel.Text = stepInterval.ToString(); })); } } } // WiiMote Data Handling // Y-Mote Data Handling if(ymoteUse) { Byte[] buffer = new Byte[DATA_BUFFER_SIZE]; if(serialPort.BytesToRead >= DATA_BUFFER_SIZE) { int recvBytes = serialPort.Read(buffer, 0, DATA_BUFFER_SIZE); if(recvBytes >= DATA_BUFFER_SIZE) { } } } Thread.Sleep(1); } } catch (System.Exception e) { MessageBox.Show(e.ToString()); } }
public AlarmEntity() { meta = new Head(); body = new Body(); }
public Typeface Read(Stream stream, ReadFlags readFlags = ReadFlags.Full) { var little = BitConverter.IsLittleEndian; using (var input = new ByteOrderSwappingBinaryReader(stream)) { ushort majorVersion = input.ReadUInt16(); ushort minorVersion = input.ReadUInt16(); ushort tableCount = input.ReadUInt16(); ushort searchRange = input.ReadUInt16(); ushort entrySelector = input.ReadUInt16(); ushort rangeShift = input.ReadUInt16(); var tables = new TableEntryCollection(); for (int i = 0; i < tableCount; i++) { tables.AddEntry(new UnreadTableEntry(ReadTableHeader(input))); } //------------------------------------------------------------------ OS2Table os2Table = ReadTableIfExists(tables, input, new OS2Table()); NameEntry nameEntry = ReadTableIfExists(tables, input, new NameEntry()); Head header = ReadTableIfExists(tables, input, new Head()); MaxProfile maximumProfile = ReadTableIfExists(tables, input, new MaxProfile()); HorizontalHeader horizontalHeader = ReadTableIfExists(tables, input, new HorizontalHeader()); HorizontalMetrics horizontalMetrics = ReadTableIfExists(tables, input, new HorizontalMetrics(horizontalHeader.HorizontalMetricsCount, maximumProfile.GlyphCount)); //-------------- Cmap cmaps = ReadTableIfExists(tables, input, new Cmap()); GlyphLocations glyphLocations = ReadTableIfExists(tables, input, new GlyphLocations(maximumProfile.GlyphCount, header.WideGlyphLocations)); Glyf glyf = ReadTableIfExists(tables, input, new Glyf(glyphLocations)); //-------------- Gasp gaspTable = ReadTableIfExists(tables, input, new Gasp()); VerticalDeviceMatrics vdmx = ReadTableIfExists(tables, input, new VerticalDeviceMatrics()); //-------------- PostTable postTable = ReadTableIfExists(tables, input, new PostTable()); Kern kern = ReadTableIfExists(tables, input, new Kern()); //-------------- //advanced typography GDEF gdef = ReadTableIfExists(tables, input, new GDEF()); GSUB gsub = ReadTableIfExists(tables, input, new GSUB()); GPOS gpos = ReadTableIfExists(tables, input, new GPOS()); BASE baseTable = ReadTableIfExists(tables, input, new BASE()); VerticalHeader vhea = ReadTableIfExists(tables, input, new VerticalHeader()); if (vhea != null) { VerticalMatric vmtx = ReadTableIfExists(tables, input, new VerticalMatric(vhea.NumOfLongVerMatrics)); } EBLCTable fontBmpTable = ReadTableIfExists(tables, input, new EBLCTable()); //--------------------------------------------- //about truetype instruction init //--------------------------------------------- var typeface = new Typeface( nameEntry, header.Bounds, header.UnitsPerEm, glyf.Glyphs, cmaps.CharMaps, horizontalMetrics, os2Table); //---------------------------- typeface.KernTable = kern; typeface.GaspTable = gaspTable; typeface.MaxProfile = maximumProfile; //---------------------------- FpgmTable fpgmTable = ReadTableIfExists(tables, input, new FpgmTable()); //control values table CvtTable cvtTable = ReadTableIfExists(tables, input, new CvtTable()); typeface.ControlValues = cvtTable.controlValues; if (fpgmTable != null) { typeface.FpgmProgramBuffer = fpgmTable.programBuffer; } PrepTable propProgramTable = ReadTableIfExists(tables, input, new PrepTable()); if (propProgramTable != null) { typeface.PrepProgramBuffer = propProgramTable.programBuffer; } //------------------------- typeface.LoadOpenFontLayoutInfo( gdef, gsub, gpos, baseTable); return(typeface); } }
private void actionButtonNew_Click(object sender, RoutedEventArgs e) { HeadList mlH = HeadList.GetInstance(); ; object newItemH1 = new Head(); ((Head)newItemH1).Name = "1a"; ((Head)newItemH1).ID = 1; mlH.Add(newItemH1); object newItemH2 = new Head(); ((Head)newItemH2).Name = "2b"; ((Head)newItemH2).ID = 2; mlH.Add(newItemH2); object newItem = GetNewObject(modelType); ((Cat)newItem).Name = "est"; ((Cat)newItem).HeadP = (Head)newItemH2; ml.Add(newItem); dataGrid1.SelectedIndex = dataGrid1.Items.Count-2; SetNewModeOfForm(); }
public static void ChangeHead(string filepath, Branch newBranch) { Head head = new Head(newBranch); UpdateHead(filepath, head); }
private Head CheckOverflow(Head cur, Head before) { bool isPositive = (cur.heading < 0) ? false : true; if(Math.Abs(cur.heading - before.heading) > Math.PI) { if (isPositive) before.heading += (float)(2 * Math.PI); else before.heading -= (float)(2 * Math.PI); } if(Math.Abs(cur.heading - before.heading) > Math.PI / 2.0f) { if (cur.heading < before.heading) cur.heading = before.heading - (float)Math.PI / 2.0f; else if (cur.heading > before.heading) cur.heading = before.heading + (float)Math.PI / 2.0f; } return cur; }
public static Head HeadFactory() { Head temp = new Head(); return(temp); }
public Robot() { Head = new Head(); RightArm = new Arm(); LeftArm = new Arm(); }
public bool SanityCheck() { return(Head.SanityCheck()); }
public A HeadOr(Func <A> a) { return(Head.ValueOr(a)); }
/// <summary> /// Removes a value from the <see cref="SkipList{T}"/>. /// </summary> /// <param name="item">The value to remove from the <see cref="SkipList{T}"/>.</param> /// <returns>true if the value is removed successfully; otherwise false.</returns> public bool Remove(T value) { if (Count == 0) { return(false); } // Gets the nodes which have to be updated(the nodes before the one we will delete) var nodesForUpdate = new SkipListNode <T> [Height]; var curNode = Head; for (int i = Height - 1; i >= 0; i--) { while (curNode[i] != null && value.CompareTo(curNode[i].Value) > 0) { curNode = curNode[i]; } nodesForUpdate[i] = curNode; } var nodeToDelete = nodesForUpdate[0][0]; if (nodeToDelete != null && value.CompareTo(nodeToDelete.Value) == 0) { // Removing references to the node for deletion and changing them to the node after it for (int i = 0; i < Head.Height; i++) { if (nodesForUpdate[i][i] != nodeToDelete) { break; } else { nodesForUpdate[i][i] = nodeToDelete[i]; } // the node now points to the node after the node for removal // Note: // nodesForUpdate is an array of the nodes before the one we are deleting. // nodesForUpdate[i] is the node on the level i before the node for removal. // nodesForUpdate[i][i] is the reference to the next node on level i. } // Removing references of deleted node nodeToDelete.Invalidate(); // Check if we have to decrease the list level if (Head[Head.Height - 1] == null) { Head.DecrementHeight(); } Count--; return(true); } else { return(false); } }
public override int GetHashCode() { return(Head.GetHashCode() ^ Tail.GetHashCode()); }
void LateUpdate() { //************************************************************************************************************************************************* // Bone rotation if (!shared.IsActive) { return; } //Set const varialbes to shared script shared.crouch_max = MAXCROUCH; shared.ang_t = ANGT; shared.yaw_max = MAXYAW; shared.pitch_max = MAXPITCH; if (shared.lastHit != 0) //Taking damage animation { crouch = Mathf.Lerp(crouch, (MAXCROUCH * transform.localScale.x) / 2, 1.0f); shared.lastHit--; Head.GetChild(0).transform.rotation *= Quaternion.Euler(shared.lastHit, 0, 0); } else if (reset) //Reset { anm.SetFloat("Turn", Mathf.Lerp(anm.GetFloat("Turn"), 0.0f, ANGT / 3)); spineX = Mathf.Lerp(spineX, 0.0f, ANGT / 3); spineY = Mathf.Lerp(spineY, 0.0f, ANGT / 3); crouch = Mathf.Lerp(crouch, 0, ANGT / 3); } else { shared.TargetLooking(spineX, spineY, crouch); spineX = Mathf.Lerp(spineX, shared.spineX_T, ANGT / 3); spineY = Mathf.Lerp(spineY, shared.spineY_T, ANGT / 3); crouch = Mathf.Lerp(crouch, shared.crouch_T, ANGT); } //Save head position befor transformation shared.fixedHeadPos = Head.position; //Spine rotation float spineZ = spineY * spineX / MAXYAW; Spine0.transform.rotation *= Quaternion.Euler(-spineY, spineZ, -spineX); Spine1.transform.rotation *= Quaternion.Euler(-spineY, spineZ, -spineX); Spine2.transform.rotation *= Quaternion.Euler(-spineY, spineZ, -spineX); Spine3.transform.rotation *= Quaternion.Euler(-spineY, spineZ, -spineX); Spine4.transform.rotation *= Quaternion.Euler(-spineY, spineZ, -spineX); Spine5.transform.rotation *= Quaternion.Euler(-spineY, spineZ, -spineX); Neck0.transform.rotation *= Quaternion.Euler(-spineY, spineZ, -spineX); Neck1.transform.rotation *= Quaternion.Euler(-spineY, spineZ, -spineX); Neck2.transform.rotation *= Quaternion.Euler(-spineY, spineZ, -spineX); Neck3.transform.rotation *= Quaternion.Euler(-spineY, spineZ, -spineX); Head.transform.rotation *= Quaternion.Euler(-spineY, spineZ, -spineX); //Tail rotation tailX = Mathf.Lerp(tailX, anm.GetFloat("Turn") * MAXYAW, ANGT / 3); Tail0.transform.rotation *= Quaternion.Euler(0, 0, tailX); Tail1.transform.rotation *= Quaternion.Euler(0, 0, tailX); Tail2.transform.rotation *= Quaternion.Euler(0, 0, tailX); Tail3.transform.rotation *= Quaternion.Euler(0, 0, tailX); Tail4.transform.rotation *= Quaternion.Euler(0, 0, tailX); Tail5.transform.rotation *= Quaternion.Euler(0, 0, tailX); Tail6.transform.rotation *= Quaternion.Euler(0, 0, tailX); Tail7.transform.rotation *= Quaternion.Euler(0, 0, tailX); Tail8.transform.rotation *= Quaternion.Euler(0, 0, tailX); //Arms rotation Arm1.transform.rotation *= Quaternion.Euler(spineY * 8, 0, 0); Arm2.transform.rotation *= Quaternion.Euler(0, spineY * 8, 0); //IK feet (require "JP script extension" asset) shared.SmallBipedIK(Right_Hips, Right_Leg, Right_Foot0, Right_Foot1, Left_Hips, Left_Leg, Left_Foot0, Left_Foot1); //Check for ground layer shared.GetGroundAlt(false, crouch); //************************************************************************************************************************************************* // CPU (require "JP script extension" asset) if (shared.AI && shared.Health != 0) { shared.AICore(1, 2, 3, 4, 5, 6, 7); } //************************************************************************************************************************************************* // Human else if (shared.Health != 0) { shared.GetUserInputs(1, 2, 3, 4, 5, 6, 7); } //************************************************************************************************************************************************* //Dead else { anm.SetBool("Attack", false); anm.SetInteger("Move", 0); anm.SetInteger("Idle", -1); } }
public override bool IsOrCanBeOfType(SymbolType symbolType) { return(Head.IsOrCanBeOfType(symbolType) || Tail.IsOrCanBeOfType(symbolType)); }
/** * Post-load initialisation. */ public void load() { var suitDirs = new Dictionary<string, int>(); string lastTextureName = ""; foreach (GameDatabase.TextureInfo texInfo in GameDatabase.Instance.databaseTexture) { Texture2D texture = texInfo.texture; if (texture == null || !texture.name.StartsWith(Util.DIR, StringComparison.Ordinal)) continue; // Add a head texture. if (texture.name.StartsWith(DIR_HEADS, StringComparison.Ordinal)) { texture.wrapMode = TextureWrapMode.Clamp; string headName = texture.name.Substring(DIR_HEADS.Length); if (headName.EndsWith("NRM", StringComparison.Ordinal)) { string baseName = headName.Substring(0, headName.Length - 3); Head head = heads.Find(h => h.name == baseName); if (head != null) head.headNRM = texture; } else if (heads.All(h => h.name != headName)) { Head head = new Head { name = headName, head = texture }; heads.Add(head); } } // Add a suit texture. else if (texture.name.StartsWith(DIR_SUITS, StringComparison.Ordinal)) { texture.wrapMode = TextureWrapMode.Clamp; int lastSlash = texture.name.LastIndexOf('/'); int dirNameLength = lastSlash - DIR_SUITS.Length; string originalName = texture.name.Substring(lastSlash + 1); if (dirNameLength < 1) { Util.log("Suit texture should be inside a subdirectory: {0}", texture.name); } else { string dirName = texture.name.Substring(DIR_SUITS.Length, dirNameLength); int index; if (!suitDirs.TryGetValue(dirName, out index)) { index = suits.Count; suits.Add(new Suit { name = dirName }); suitDirs.Add(dirName, index); } Suit suit = suits[index]; if (!suit.setTexture(originalName, texture)) Util.log("Unknown suit texture name \"{0}\": {1}", originalName, texture.name); } } else if (texture.name.StartsWith(DIR_DEFAULT, StringComparison.Ordinal)) { int lastSlash = texture.name.LastIndexOf('/'); string originalName = texture.name.Substring(lastSlash + 1); if (originalName == "kerbalHead") { defaultHead[0].head = texture; texture.wrapMode = TextureWrapMode.Clamp; } else if (originalName == "kerbalHeadNRM") { defaultHead[0].headNRM = texture; texture.wrapMode = TextureWrapMode.Clamp; } else if (originalName == "kerbalGirl_06_BaseColor") { defaultHead[1].head = texture; texture.wrapMode = TextureWrapMode.Clamp; } else if (originalName == "kerbalGirl_06_BaseColorNRM") { defaultHead[1].headNRM = texture; texture.wrapMode = TextureWrapMode.Clamp; } else if (defaultSuit.setTexture(originalName, texture) || originalName == "kerbalMain") { texture.wrapMode = TextureWrapMode.Clamp; } } lastTextureName = texture.name; } readKerbalsConfigs(); // Initialise default Kerbal, which is only loaded when the main menu shows. foreach (Texture2D texture in Resources.FindObjectsOfTypeAll<Texture2D>()) { if (texture.name != null) { if (texture.name == "kerbalHead") defaultHead[0].head = defaultHead[0].head ?? texture; else if (texture.name == "kerbalGirl_06_BaseColor") defaultHead[1].head = defaultHead[1].head ?? texture; else defaultSuit.setTexture(texture.name, texture); } } foreach (Kerbal kerbal in Resources.FindObjectsOfTypeAll<Kerbal>()) { int gender = kerbal.transform.name == "kerbalFemale" ? 1 : 0; // Save pointer to helmet & visor meshes so helmet removal can restore them. foreach (SkinnedMeshRenderer smr in kerbal.GetComponentsInChildren<SkinnedMeshRenderer>(true)) { if (smr.name.EndsWith("helmet", StringComparison.Ordinal)) helmetMesh[gender] = smr.sharedMesh; else if (smr.name.EndsWith("visor", StringComparison.Ordinal)) visorMesh[gender] = smr.sharedMesh; } // After na IVA space is initialised, suits are reset to these values. Replace stock textures with default ones. kerbal.textureStandard = defaultSuit.suit; kerbal.textureVeteran = defaultSuit.suitVeteran; if (kerbal.GetComponent<TRIvaModule>() == null) kerbal.gameObject.AddComponent<TRIvaModule>(); } Part[] evas = { PartLoader.getPartInfoByName("kerbalEVA").partPrefab, PartLoader.getPartInfoByName("kerbalEVAfemale").partPrefab }; foreach (Part eva in evas) { if (eva.GetComponent<TREvaModule>() == null) eva.gameObject.AddComponent<TREvaModule>(); } // Re-read scenario if database is reloaded during the space centre scene to avoid losing all per-game settings. if (HighLogic.CurrentGame != null) { ConfigNode scenarioNode = HighLogic.CurrentGame.config.GetNodes("SCENARIO") .FirstOrDefault(n => n.GetValue("name") == "TRScenario"); if (scenarioNode != null) loadScenario(scenarioNode); } }
public override bool IsOrCanBeOfType([NotNull] params SymbolType[] symbolTypes) { return(Head.IsOrCanBeOfType(symbolTypes) || Tail.IsOrCanBeOfType(symbolTypes)); }
} = true; // no need to sync it at the moment public async Task LoadBlocksFromDb( CancellationToken cancellationToken, UInt256?startBlockNumber = null, int batchSize = DbLoadBatchSize, int maxBlocksToLoad = int.MaxValue) { try { CanAcceptNewBlocks = false; byte[] deletePointer = _blockInfoDb.Get(DeletePointerAddressInDb); if (deletePointer != null) { Keccak deletePointerHash = new Keccak(deletePointer); if (_logger.IsInfo) { _logger.Info($"Cleaning invalid blocks starting from {deletePointer}"); } CleanInvalidBlocks(deletePointerHash); } if (startBlockNumber == null) { startBlockNumber = Head?.Number ?? 0; } else { Head = startBlockNumber == 0 ? null : FindBlock(startBlockNumber.Value - 1)?.Header; } BigInteger blocksToLoad = BigInteger.Min(FindNumberOfBlocksToLoadFromDb(), maxBlocksToLoad); if (blocksToLoad == 0) { if (_logger.IsInfo) { _logger.Info("Found no blocks to load from DB."); } } else { if (_logger.IsInfo) { _logger.Info($"Found {blocksToLoad} blocks to load from DB starting from current head block {Head?.ToString(BlockHeader.Format.Short)}."); } } UInt256 blockNumber = startBlockNumber.Value; for (int i = 0; i < blocksToLoad; i++) { if (cancellationToken.IsCancellationRequested) { break; } ChainLevelInfo level = LoadLevel(blockNumber); if (level == null) { break; } BigInteger maxDifficultySoFar = 0; BlockInfo maxDifficultyBlock = null; for (int blockIndex = 0; blockIndex < level.BlockInfos.Length; blockIndex++) { if (level.BlockInfos[blockIndex].TotalDifficulty > maxDifficultySoFar) { maxDifficultyBlock = level.BlockInfos[blockIndex]; maxDifficultySoFar = maxDifficultyBlock.TotalDifficulty; } } level = null; // ReSharper disable once ConditionIsAlwaysTrueOrFalse if (level != null) // ReSharper disable once HeuristicUnreachableCode { // ReSharper disable once HeuristicUnreachableCode throw new InvalidOperationException("just be aware that this level can be deleted by another thread after here"); } if (maxDifficultyBlock == null) { throw new InvalidOperationException($"Expected at least one block at level {blockNumber}"); } Block block = FindBlock(maxDifficultyBlock.BlockHash, false); if (block == null) { if (_logger.IsError) { _logger.Error($"Could not find block {maxDifficultyBlock.BlockHash}. DB load cancelled."); } _dbBatchProcessed?.SetResult(null); break; } BestSuggested = block.Header; NewBestSuggestedBlock?.Invoke(this, new BlockEventArgs(block)); if (i % batchSize == batchSize - 1 && !(i == blocksToLoad - 1) && (Head.Number + (UInt256)batchSize) < blockNumber) { if (_logger.IsInfo) { _logger.Info($"Loaded {i + 1} out of {blocksToLoad} blocks from DB into processing queue, waiting for processor before loading more."); } _dbBatchProcessed = new TaskCompletionSource <object>(); using (cancellationToken.Register(() => _dbBatchProcessed.SetCanceled())) { _currentDbLoadBatchEnd = blockNumber - (UInt256)batchSize; await _dbBatchProcessed.Task; } } blockNumber++; } if (cancellationToken.IsCancellationRequested) { _logger.Info($"Canceled loading blocks from DB at block {blockNumber}"); } if (_logger.IsInfo) { _logger.Info($"Completed loading blocks from DB at block {blockNumber}"); } } finally { CanAcceptNewBlocks = true; } }
public void BindToObjects(Head h, Body b) { head = h; body = b; }
private ILimb GetHead() { var head = new Head(); head.Limbs.AddRange(GetEyes()); head.Limbs.AddRange(GetEars()); head.Limbs.Add(new Mouth()); head.Limbs.Add(new Nose()); head.Organs.Add(new Brain()); return head; }
public WalkingDead (RectangleF frame) :base (frame) { BackgroundColor = UIColor.Clear; ClipsToBounds = false; head = new Head (new RectangleF (0, 0, Frame.Size.Width, Frame.Size.Height * .25f)); AddSubview (head); body = new Body (new RectangleF (0, head.Frame.GetMaxY (), Frame.Size.Width, Frame.Size.Height * .375f)); AddSubview (body); leftArm = new LeftArm (new RectangleF (0, 0, Frame.Size.Width + 20, Frame.Size.Height)); AddSubview (leftArm); rightArm = new RightArm (new RectangleF (0, 0, Frame.Size.Width, Frame.Size.Height)); AddSubview (rightArm); rightLeg = new RightLeg (new RectangleF (0, 0, Frame.Size.Width, Frame.Size.Height)); AddSubview (rightLeg); leftLeg = new LeftLeg (new RectangleF (0, 0, Frame.Size.Width, Frame.Size.Height)); AddSubview (leftLeg); TurnAround (); }