public void setCarac(int pv, int maxpv, int armor, ALIGN align = ALIGN.both, TOUCHABLESTATE state = TOUCHABLESTATE.normal) { _pv = pv; _maxPv = maxpv; _armor = armor; setAlign(align); }
public hgRect CalcRealRect(float[] margin, ALIGN align, float iwidth, float iheight, Vector2 disparea) { var rbase = CalcPadding(margin); hgRect r2 = new hgRect(rbase); var height = (iheight < 0) ? (r2.IsInifinityHeight() ? disparea.y : r2.height) * (-iheight) : iheight; r2.SetHeight(height); //r2.SetHeight(iheight); var width = (iwidth < 0) ? r2.width * (-iwidth) : iwidth; //Negative is a ratio. r2.SetWidth(iwidth); if (align == ALIGN.CENTER) { r2.SetCenterX(rbase.center.x); } else if (align == ALIGN.RIGHT) { var v = new Vector2(rbase._rightX - r2._rightX, 0); r2.Move(v); } return(r2); }
public void ChangeOrientation(ORIENTATION _orientation, ALIGN _align) { m_orientation = _orientation; m_align = _align; m_gaugeTransform.localPosition = m_initPos; ComputeEdge(); }
public IEnumerator _DoubleWeapon() { currentKind = ALIGN.demonic; animationSpeed = 10; yield return(new WaitForSeconds(1.05f / animationSpeed)); animationSpeed = 10; }
internal Field(string fieldName, string headerName, int width, ALIGN TextAlignment) { FieldName = fieldName; HeaderName = headerName; BackColor = Color.White; Width = width; BackColor = Color.White; HeaderBackColor = Color.White; Alignment = TextAlignment; }
public Field(string fieldName, string headerName, int width, ALIGN TextAlignment) { this.isTotalField = false; this.string_2 = "LEFT"; this.FieldName = fieldName; this.HeaderName = headerName; this.BackColor = Color.White; this.Width = width; this.BackColor = Color.White; this.HeaderBackColor = Color.White; this.Alignment = TextAlignment; }
public void Sword() { currentKind = ALIGN.demonic; leftWeapon = 8; rightWeapon = 9; animator.SetInteger("LeftRight", 3); animator.SetInteger("Weapon", 7); animator.SetInteger("LeftWeapon", leftWeapon); animator.SetInteger("RightWeapon", rightWeapon); animator.SetBool("Armed", true); weapon = Item.ARMED; twoHandBow.SetActive(false); swordL.SetActive(true); swordR.SetActive(true); }
public void Bow() { currentKind = ALIGN.angelic; leftWeapon = 4; animator.SetInteger("LeftRight", 3); animator.SetInteger("Weapon", 4); animator.SetInteger("LeftWeapon", 0); animator.SetInteger("RightWeapon", 0); animator.SetBool("Armed", true); animator.SetTrigger("WeaponUnsheathTrigger"); weapon = Item.TWOHANDBOW; twoHandBow.SetActive(true); swordL.SetActive(false); swordR.SetActive(false); }
public void Init(Transform s, int sw, int sh, int tw, int th, ALIGN align) { _source = s; _sourceStartX = _source.position.x; _sourceStartY = _source.position.y; _sourceWidth = sw; _sourceHeight = sh; _targetWidth = tw; _targetHeight = th; _scaleX = tw / sw; _scaleY = th / sh; _align = align; }
public override void ElementWork(hglParser.Element te) { var atrs = te.attrib; ALIGN align = ALIGN.NONE; if ((string)atrs["align"] == "left") { align = ALIGN.LEFT; } if ((string)atrs["align"] == "center") { align = ALIGN.CENTER; } if ((string)atrs["align"] == "right") { align = ALIGN.RIGHT; } if (align == ALIGN.NONE) { var margin = te.thisStyle.GetMargin(); if (margin[1] == -(float)0x0a && margin[3] == -(float)0x0a) { align = ALIGN.CENTER; } } float cellpadding = hglEtc.GetFloat("cellpadding", atrs, 0f); float hspace = hglEtc.GetFloat("hspace", atrs, 0f); float vspace = hglEtc.GetFloat("vspace", atrs, 0f); float width = hglEtc.GetFloat("width", atrs, 0f); float height = hglEtc.GetFloat("height", atrs, 0f); float border = hglEtc.GetFloat("border", atrs, 1f); Color bordercolor = hglEtc.GetColor("bordercolor", atrs, te.thisStyle.GetColor(StyleKey.color)); te.thisStyle.Set(StyleKey.border_width, border); te.thisStyle.SetColor(StyleKey.border_color, bordercolor); Color?bgColor = hglEtc.GetColorIfErrorNull("bgcolor", atrs); if (bgColor != null) { te.thisStyle.SetColor(StyleKey.background_color, (Color)bgColor); } hglTags.m_htmlRender.CreateTableBlock(te, align, cellpadding, hspace, vspace, width, height); }
public override void ElementWork(hglParser.Element te) { var atrs = te.attrib; ALIGN align = ALIGN.LEFT; if ((string)atrs["align"] == "center") { align = ALIGN.CENTER; } if ((string)atrs["align"] == "right") { align = ALIGN.RIGHT; } float height = hglEtc.GetFloat("height", atrs, 0f); hglTags.m_htmlRender.CreateTableRow(te, align, height); }
public override void ElementWork(hglParser.Element te) { var atrs = te.attrib; ALIGN align = ALIGN.LEFT; if ((string)atrs["align"] == "center") { align = ALIGN.CENTER; } if ((string)atrs["align"] == "right") { align = ALIGN.RIGHT; } int colspan = (int)hglEtc.GetFloat("colspan", atrs, 0); int rowspan = (int)hglEtc.GetFloat("rowspan", atrs, 0); hglTags.m_htmlRender.CreateTableData(te, align, colspan, rowspan); }
public void TakeDamage(int pAttackPoint, ALIGN pAlign) { if (state == TOUCHABLESTATE.god) { return; } if (_pv <= 0) { return; } switch (align) { case ALIGN.both: break; case ALIGN.angelic: if (pAlign != ALIGN.angelic) { return; } break; case ALIGN.demonic: if (pAlign != ALIGN.demonic) { return; } break; case ALIGN.none: return; } int damage; damage = pAttackPoint - _armor; if (damage < 0) { damage = 0; } getHit(damage); }
private static RESULTCODE FormatLine_2(FRAMES frame, List <hgMesh.CD> list, ref int index, ALIGN align, out List <hgMesh.CD> newList, out Vector3 leftBase) { leftBase = Vector3.zero; newList = null; float left, right, width, top; { float[] space = frame.GetSpace(); if (space == null) { return(RESULTCODE.ERROR); } left = space[0]; right = space[1]; width = space[1] - space[0]; top = frame.yPos; } leftBase = new Vector3(left, top, 0); int startIndex = index; for (int loop = 0; loop < 100; loop++) { index = startIndex; newList = new List <hgMesh.CD>(); while (index < list.Count) { var cd = list[index]; if (cd.isCR) { if (index == 0) { newList.Add(cd); } index++; goto _ALIGN; } else if (cd is hgMesh.CD_IMAGE) { var cdimg = (hgMesh.CD_IMAGE)cd; if (cdimg.align == hgMesh.CD_IMAGE.ALIGN.LEFT) { SetImageLeft(list, index, left, top); return(RESULTCODE.FOUND_FIX_IMAGE); } else if (cdimg.align == hgMesh.CD_IMAGE.ALIGN.RIGHT) { SetImageRight(list, index, right, top); return(RESULTCODE.FOUND_FIX_IMAGE); } } var r = hgMesh.CD.CalcRectwScan(newList, cd, leftBase); var vspace = hgMesh.CD.GetVSpace(newList, cd); if (r._topY + vspace > top) { var y = leftBase.y - ((r._topY + vspace) - top); leftBase = new Vector3(leftBase.x, y, leftBase.z); goto _LOOP1; } if (r._rightX > right) { goto _ALIGN; } newList.Add(cd); index++; } goto _ALIGN; _LOOP1 :; } return(RESULTCODE.ERROR); _ALIGN: { if (align == ALIGN.CENTER) { var r = hgMesh.CD.CalcRectwScan(newList, null, newList[0].leftBase); var center_X = frame.backFrame.center.x; var r_c = r.MoveCenter(center_X); if (r_c._leftX < left) { var v = left - r_c._leftX; r_c.MoveX(v); } else if (r_c._rightX > right) { var v = right - r_c._rightX; r_c.MoveX(v); } leftBase = new Vector3(r_c._leftX, leftBase.y, leftBase.z); } else if (align == ALIGN.RIGHT) { var r = hgMesh.CD.CalcRectwScan(newList, null, newList[0].leftBase); var v = right - r._rightX; r.MoveX(v); leftBase = new Vector3(r._leftX, leftBase.y, leftBase.z); } } return(RESULTCODE.SUCCESS); }
public Field(string fieldName, string headerName, int width, ALIGN TextAlignment) { FieldName = fieldName; HeaderName = headerName; BackColor = Color.White; Width = width; BackColor = Color.White; HeaderBackColor = Color.White; Alignment = TextAlignment; }
public void setAlign(ALIGN pAlign) { align = pAlign; }
/** * <summary> * Draws a text string at the specified position. * <para> * The point of the text that is aligned * to the specified pixel position is called the anchor point, and can be chosen among * several options. Text is rendered from left to right, without implicit wrapping. * </para> * </summary> * <param name="x"> * the distance from left of layer to the text anchor point, in pixels * </param> * <param name="y"> * the distance from top of layer to the text anchor point, in pixels * </param> * <param name="anchor"> * the text anchor point, chosen among the <c>YDisplayLayer.ALIGN</c> enumeration: * <c>YDisplayLayer.ALIGN_TOP_LEFT</c>, <c>YDisplayLayer.ALIGN_CENTER_LEFT</c>, * <c>YDisplayLayer.ALIGN_BASELINE_LEFT</c>, <c>YDisplayLayer.ALIGN_BOTTOM_LEFT</c>, * <c>YDisplayLayer.ALIGN_TOP_CENTER</c>, <c>YDisplayLayer.ALIGN_CENTER</c>, * <c>YDisplayLayer.ALIGN_BASELINE_CENTER</c>, <c>YDisplayLayer.ALIGN_BOTTOM_CENTER</c>, * <c>YDisplayLayer.ALIGN_TOP_DECIMAL</c>, <c>YDisplayLayer.ALIGN_CENTER_DECIMAL</c>, * <c>YDisplayLayer.ALIGN_BASELINE_DECIMAL</c>, <c>YDisplayLayer.ALIGN_BOTTOM_DECIMAL</c>, * <c>YDisplayLayer.ALIGN_TOP_RIGHT</c>, <c>YDisplayLayer.ALIGN_CENTER_RIGHT</c>, * <c>YDisplayLayer.ALIGN_BASELINE_RIGHT</c>, <c>YDisplayLayer.ALIGN_BOTTOM_RIGHT</c>. * </param> * <param name="text"> * the text string to draw * </param> * <returns> * <c>YAPI.SUCCESS</c> if the call succeeds. * </returns> * <para> * On failure, throws an exception or returns a negative error code. * </para> */ public virtual int drawText(int x, int y, ALIGN anchor, string text) { return this.command_flush("T" + Convert.ToString(x) + "," + Convert.ToString(y) + "," + ((int)(anchor)).ToString() + "," + text + "" + ((char)(27)).ToString()); }
/** * <summary> * Draws a text string at the specified position. * <para> * The point of the text that is aligned * to the specified pixel position is called the anchor point, and can be chosen among * several options. Text is rendered from left to right, without implicit wrapping. * </para> * </summary> * <param name="x"> * the distance from left of layer to the text anchor point, in pixels * </param> * <param name="y"> * the distance from top of layer to the text anchor point, in pixels * </param> * <param name="anchor"> * the text anchor point, chosen among the <c>YDisplayLayer.ALIGN</c> enumeration: * <c>YDisplayLayer.ALIGN.TOP_LEFT</c>, <c>YDisplayLayer.ALIGN.CENTER_LEFT</c>, * <c>YDisplayLayer.ALIGN.BASELINE_LEFT</c>, <c>YDisplayLayer.ALIGN.BOTTOM_LEFT</c>, * <c>YDisplayLayer.ALIGN.TOP_CENTER</c>, <c>YDisplayLayer.ALIGN.CENTER</c>, * <c>YDisplayLayer.ALIGN.BASELINE_CENTER</c>, <c>YDisplayLayer.ALIGN.BOTTOM_CENTER</c>, * <c>YDisplayLayer.ALIGN.TOP_DECIMAL</c>, <c>YDisplayLayer.ALIGN.CENTER_DECIMAL</c>, * <c>YDisplayLayer.ALIGN.BASELINE_DECIMAL</c>, <c>YDisplayLayer.ALIGN.BOTTOM_DECIMAL</c>, * <c>YDisplayLayer.ALIGN.TOP_RIGHT</c>, <c>YDisplayLayer.ALIGN.CENTER_RIGHT</c>, * <c>YDisplayLayer.ALIGN.BASELINE_RIGHT</c>, <c>YDisplayLayer.ALIGN.BOTTOM_RIGHT</c>. * </param> * <param name="text"> * the text string to draw * </param> * <returns> * <c>YAPI.SUCCESS</c> if the call succeeds. * </returns> * <para> * On failure, throws an exception or returns a negative error code. * </para> */ public virtual async Task <int> drawText(int x, int y, ALIGN anchor, string text) { return(await this.command_flush("T" + Convert.ToString(x) + "," + Convert.ToString(y) + "," + ((int)(anchor)).ToString() + "," + text + "" + ((char)(27)).ToString())); }
public static RESULTCODE FormatLine(FRAMES frame, List <hgMesh.CD> list, ref int index, ALIGN align, out List <hgMesh.CD> newList, out Vector3 leftBase) { if (index == 0 && list[index].isHR) { return(FormatLine_NORMAL(frame, list, ref index, align, out newList, out leftBase)); } else { return(FormatLine_NORMAL(frame, list, ref index, align, out newList, out leftBase)); } }
public void Format(/*hglHtmlRender.BASE tableBlock,*/ ALIGN align, hgRect curRect, out hgRect doneRealRect, out hgRect doneMarginRect) { foreach (var tr in m_table.trlist) { foreach (var td in tr.tdlist) { td.CreatePadWpaddingRect(m_table.cellpadding + m_table.xe.thisStyle.GetFloat(StyleKey.border_width, float.NaN)); SetTD(td); } } int validWidth = m_baseTable.Get_max_x() + 1; int validHeight = m_baseTable.Get_max_y() + 1; m_baseTable.Normalize(); m_xLenList = new LENVAL[validWidth]; for (int i = 0; i < m_xLenList.Length; i++) { m_xLenList[i] = new LENVAL() { len = -1 } } ; m_yLenList = new LENVAL[validHeight]; for (int i = 0; i < m_yLenList.Length; i++) { m_yLenList[i] = new LENVAL() { len = -1 } } ; bool bNeedUpdate = true; int loopIndex = 0; while (bNeedUpdate) { if (loopIndex++ > 100) { Debug.LogError("Too much Loop"); break; } bNeedUpdate = false; for (var y = 0; y < validHeight; y++) { for (var x = 0; x < validWidth; x++) { float w, h; if (GetWH(x, y, out w, out h)) { if (w > 0 && w > m_xLenList[x].len) { bNeedUpdate = true; m_xLenList[x].len = w; } if (h > 0 && h > m_yLenList[y].len) { bNeedUpdate = true; m_yLenList[y].len = h; } } } } } //Relocate var tmpDoneRealRect = new hgRect(); for (int y = 0; y < validHeight; y++) { for (int x = 0; x < validWidth; x++) { var dt = m_baseTable.GetPoint(x, y); if (dt.mode == Element.Mode.ORIGINAL) { if (dt.td == null) { continue; } var w = LENVAL.GetWidth(m_xLenList, x, dt.spanLastCol); var h = LENVAL.GetWidth(m_yLenList, y, dt.spanLastRow); var lx = x > 0 ? LENVAL.GetWidth(m_xLenList, 0, x - 1) : 0; var ly = y > 0 ? LENVAL.GetWidth(m_yLenList, 0, y - 1) : 0; tmpDoneRealRect.Sample(new hgRect(lx, -ly, w, h)); Vector2 v = Vector2.zero; { Vector2 center = new Vector2(lx + w / 2, -(ly + h / 2)); //Debug.LogWarning(dt.td.block.ToString() + ">" + center + " Aligh=" + align); v = center - dt.td.padding_w_padRect.center; } dt.td.block.Relocate(v); //Enlarge td.block.doneRealRect to fit. dt.td.block.doneRealRect.ChangWidth(w); dt.td.block.doneRealRect.ChangHeight(h); dt.td.block.doneMarginRect = new hgRect(dt.td.block.doneRealRect); } } } Debug.Log("tmpDoneRealRect = " + tmpDoneRealRect); float reltopY = curRect._topY; float reltopX = curRect._leftX; if (m_table.align == ALIGN.CENTER) { reltopX = curRect._leftX + curRect.width / 2 - tmpDoneRealRect.width / 2; } else if (m_table.align == ALIGN.RIGHT) { reltopX = curRect._rightX - tmpDoneRealRect.width; } Vector3 v2 = new Vector3(reltopX, reltopY, 0) - hglEtc.toVector3(tmpDoneRealRect.topLeft); if (v2 != Vector3.zero) { foreach (var tr in m_table.trlist) { foreach (var td in tr.tdlist) { td.block.Relocate(v2); } } } tmpDoneRealRect.Move(v2); //Fix align foreach (var tr in m_table.trlist) { foreach (var td in tr.tdlist) { td.block.ReAlign(); } } // For centering if (align == ALIGN.CENTER) { var v3 = new Vector3(m_table.padRect.center.x - tmpDoneRealRect.center.x, 0, 0); tmpDoneRealRect.Move(v3); foreach (var tr in m_table.trlist) { foreach (var td in tr.tdlist) { td.block.Relocate(v3); } } } doneRealRect = tmpDoneRealRect; doneMarginRect = new hgRect(doneRealRect); doneMarginRect.max_v += new Vector2(m_table.hspace, m_table.vspace); doneMarginRect.min_v -= new Vector2(m_table.hspace, m_table.vspace); } bool GetWH(int x, int y, out float w, out float h) { w = -1; // means Unknown h = -1; // means Unknown var elm = m_baseTable.GetPoint(x, y); if (elm == null) { w = 0; h = 0; return(true); } // throw new SystemException("ERROR: TABLE("+x+","+y+")" ); if (elm.mode == Element.Mode.ORIGINAL) { if (elm.spanLastCol == x) { w = (elm.td != null) ? elm.td.padding_w_padRect.width : 0; } if (elm.spanLastRow == y) { h = (elm.td != null) ? elm.td.padding_w_padRect.height : 0; } return(true); } else if (elm.mode == Element.Mode.SPAN) { var basedt = elm.original; if (basedt.spanLastCol == x) { var lw = LENVAL.GetWidth(m_xLenList, basedt.x, basedt.spanLastCol - 1); if (lw >= 0) { w = basedt.td.padding_w_padRect.width - lw; } } if (basedt.spanLastRow == y) { var lw = LENVAL.GetWidth(m_yLenList, basedt.y, basedt.spanLastRow - 1); if (lw >= 0) { h = basedt.td.padding_w_padRect.height - lw; } } return(true); } return(false); }