/// <summary> /// Use this for initialization /// </summary> void Awake() { fieldPositions = new FieldPosition[figureCapacity]; InitializeFieldPositions(positions); for (int i = 0; i < 4; ++i) { redPositions[i] = fieldPositions[i]; yellowPositions[i] = fieldPositions[i + 4]; bluePositions[i] = fieldPositions[i + 8]; greenPositions[i] = fieldPositions[i + 12]; } }
/// <summary> /// 引数に渡したキャラクターをバトルに参加させます /// </summary> /// <param name="bal">参加させるキャラクター</param> /// <param name="pos">参加させる位置</param> /// <param name="ai">キャラクターのAI</param> public void joinBattle(IBattleable bal, FieldPosition pos, IEnemyAI ai) { if (!isBattleing) { throw new InvalidOperationException("battle isn't started"); } loadContainer(bal); bal.setIsBattling(true); joinedCharacter[pos].Add(bal); bal.syncronizePositioin(field.getObjectPosition(pos, bal)); AIBattleTaskManager manager = MonoBehaviour.Instantiate((GameObject)Resources.Load("Prefabs/AIBattleManager")).GetComponent <AIBattleTaskManager>(); manager.transform.SetParent(bal.getContainer().transform); manager.setCharacter(bal, ai); joinedManager.Add(bal.getUniqueId(), manager); }
/// <summary> /// 引数に渡したキャラクターをバトルに参加させます /// </summary> /// <param name="playable">参加させるキャラクター</param> /// <param name="pos">参加させる位置</param> public void joinBattle(IPlayable playable, FieldPosition pos) { if (!isBattleing) { throw new InvalidOperationException("battle isn't started"); } loadContainer(playable); playable.setIsBattling(true); joinedCharacter [pos].Add(playable); playable.syncronizePositioin(field.getObjectPosition(pos, playable)); GameObject view = MonoBehaviour.Instantiate((GameObject)Resources.Load("Prefabs/PlayerBattleTaskManager")); PlayerBattleTaskManager manager = view.GetComponent <PlayerBattleTaskManager> (); manager.setPlayer(playable, KeyCode.R); joinedManager.Add(playable.getUniqueId(), manager); }
public ICaster getCasterFromFieldPosition(FieldPosition pos) { int index = (int)pos; ICaster target = null; if (index > 0) { if (index < 3) { target = enemy_arr[index]; } else { target = player_arr[index - 3]; } } return(target); }
/// <summary> /// Adds a new FieldContainer with MessageFormat.Field.ARGUMENT field, /// argnumber, begin and end index to the fields vector, or sets the /// position's begin and end index if it has MessageFormat.Field.ARGUMENT as /// its field attribute. /// </summary> /// /// <param name="begin"></param> /// <param name="end"></param> /// <param name="argnumber"></param> /// <param name="position"></param> /// <param name="fields"></param> private void HandleArgumentField(int begin, int end, int argnumber, FieldPosition position, List <FieldContainer> fields) { if (fields != null) { fields.Add(new MessageFormat.FieldContainer(begin, end, MessageFormat.Field.ARGUMENT, ((int)(argnumber)))); } else { if (position != null && (Object)position.GetFieldAttribute() == (Object)MessageFormat.Field.ARGUMENT && position.GetEndIndex() == 0) { position.SetBeginIndex(begin); position.SetEndIndex(end); } } }
/// <summary> /// 起点となるキャラクターから指定された位置までのキャラクター数を取得します /// </summary> /// <returns>キャラクター数</returns> /// <param name="bal">起点となるキャラクター</param> /// <param name="range">検索したい範囲</param> public int sumFromAreaTo(IBattleable bal, int range) { if (!isBattleing) { throw new InvalidOperationException("battle isn't started"); } FieldPosition nowPos = searchCharacter(bal); int count = 0; int index = restructionPositionValue(nowPos, -1 * range); int maxPos = restructionPositionValue(nowPos, range); for (; index <= maxPos; index++) { count += joinedCharacter[(FieldPosition)index].Count; } //自分が1つ入るので-1 return(count - 1); }
void CheckBorderConditions(FieldPosition prevoiusPosition) { jump = prevoiusPosition.jump; if (origin.x < 0) { origin.x += width; jump = true; } if (origin.x > width - 1) { origin.x -= width; jump = true; } if (origin.y < 0) { origin.y += height; jump = true; } if (origin.y > height - 1) { origin.y -= height; jump = true; } }
/// <summary> /// 与えられたキャラクターの位置から与えられた位置までにいるキャラクターを返します /// </summary> /// <returns>位置の中にいたキャラクターのリスト</returns> /// <param name="bal">起点となるキャラクター</param> /// <param name="range">判定したい範囲</param> public List <IBattleable> getCharacterInRange(IBattleable bal, int range) { if (!isBattleing) { throw new InvalidOperationException("battle isn't started"); } //Range内のIBattleableを検索 List <IBattleable> list = new List <IBattleable>(); FieldPosition pos = searchCharacter(bal); int index = restructionPositionValue(pos, -1 * range); int maxPos = restructionPositionValue(pos, range); for (; index <= maxPos; index++) { list.AddRange(joinedCharacter[(FieldPosition)index]); } return(list); }
void Move(FieldPosition originPosition, FieldPosition targetPosition) { int addend = 10; Vector2 direction = (Vector2)originPosition - targetPosition; StopAllCoroutines(); if (targetPosition.jump) { StartCoroutine(moveSmoothly(transform.position, targetPosition + direction * addend, 5)); StartCoroutine(timer(0.2f, (bool countdownIsOver) => { if (countdownIsOver) { StopAllCoroutines(); StartCoroutine(moveSmoothly(targetPosition - direction * addend, targetPosition, 20)); } })); } else { StartCoroutine(moveSmoothly(transform.position, targetPosition, 20)); } }
/// <summary> /// スキルの効果範囲が範囲の場合のターゲットをスクロールビューに表示します /// </summary> /// <param name="range">スキルの射程</param> private void inputAreaTargetList(int range) { FieldPosition nowPos = BattleManager.getInstance().searchCharacter(player); backButton.gameObject.SetActive(true); isInputingBackButton = true; int index = BattleManager.getInstance().restructionPositionValue(nowPos, -range); int maxRange = BattleManager.getInstance().restructionPositionValue(nowPos, range); for (; index <= maxRange; index++) { if (index == (int)nowPos) { continue; } GameObject node = Instantiate((GameObject)Resources.Load("Prefabs/TargetNode")); node.GetComponent <TargetNode>().setState((FieldPosition)index, this); node.transform.SetParent(contents.transform); } }
public void Write(GamePacketWriter writer) { writer.Write(CastingId); writer.Write(Spell4Id, 18u); writer.Write(RootSpell4Id, 18u); writer.Write(ParentSpell4Id, 18u); writer.Write(CasterId); writer.Write(Unknown20); writer.Write(PrimaryTargetId); FieldPosition.Write(writer); writer.Write(Yaw); writer.Write(InitialPositionData.Count, 8u); InitialPositionData.ForEach(i => i.Write(writer)); writer.Write(TelegraphPositionData.Count, 8u); TelegraphPositionData.ForEach(t => t.Write(writer)); writer.Write(UserInitiatedSpellCast); writer.Write(UseCreatureOverrides); }
/// <summary> /// 非好戦的な移動を行います /// </summary> /// <returns>移動量</returns> /// <param name="useSkill">使用するスキル</param> private int recession(MoveSkill useSkill) { Debug.Log("reacession"); //エリア危険性レベルを取得 Dictionary <FieldPosition, int> areaDangerLevelTable = BattleManager.getInstance().getAreaDangerLevelTableInRange(user, useSkill.getMove(user)); Dictionary <int, int> dangerLevelIntegerTable = new Dictionary <int, int>(); var keys = areaDangerLevelTable.Keys; int sumDangerLevel = 0; foreach (FieldPosition pos in keys) { sumDangerLevel += areaDangerLevelTable[pos]; dangerLevelIntegerTable.Add((int)pos, areaDangerLevelTable[pos]); } //最終判定:レベルが低いところへ FieldPosition nowPos = BattleManager.getInstance().searchCharacter(user); int move = MathHelper.getRandomKeyLowerOrderProbality(dangerLevelIntegerTable) - (int)nowPos; //move = move = BattleManager.getInstance().restructionPositionValue(nowPos, move); return(move); }
public void deleteCharacterPos(IBattleable bal) { KeyValuePair <FieldPosition, KeyValuePair <int, int> > postionPair = characterPosition[bal]; FieldPosition fieldPos = postionPair.Key; int x = postionPair.Value.Key; int z = postionPair.Value.Value; //居たところの周囲1マスを開ける for (int i = -1; i < 2; i++) { int targetZ = z + i; if (targetZ < 0) { targetZ = 0; } else if (targetZ >= canSetCharacterPos.Count) { targetZ = canSetCharacterPos.Count - 1; } for (int j = -1; j < 2; j++) { int targetX = x + j; if (targetX < 0) { targetX = 0; } else if (targetX >= canSetCharacterPos.Count) { targetX = canSetCharacterPos.Count - 1; } canSetCharacterPos[fieldPos][targetX][targetZ] = true; } } characterPosition.Remove(bal); }
private ILOG.J2CsMapping.Text.AttributedCharacterIterator FormatToCharacterIteratorImpl(DateTime date) { StringBuilder buffer = new StringBuilder(); List <FieldPosition> fields = new List <FieldPosition>(); // format the date, and find fields FormatImpl(date, buffer, null, fields); // create and AttributedString with the formatted buffer ILOG.J2CsMapping.Text.AttributedString // create and AttributedString with the formatted buffer al = new ILOG.J2CsMapping.Text.AttributedString(buffer.ToString()); // add DateFormat field attributes to the AttributedString for (int i = 0; i < fields.Count; i++) { FieldPosition pos = fields[i]; Format.Field attribute = pos.GetFieldAttribute(); al.AddAttribute(attribute, attribute, pos.GetBeginIndex(), pos.GetEndIndex()); } // return the CharacterIterator from AttributedString return(al.GetIterator()); }
// NOTE: This API still exists; we just inherit it from SimpleDateFormat // as of ICU 3.0 // /** // * @stable ICU 2.0 // */ // protected String subFormat(char ch, int count, int beginOffset, // FieldPosition pos, DateFormatSymbols formatData, // Calendar cal) { // switch (ch) { // case 'G': // 'G' - ERA // return zeroPaddingNumber(cal.get(Calendar.ERA), 1, 9); // case 'l': // 'l' - IS_LEAP_MONTH // { // ChineseDateFormatSymbols symbols = // (ChineseDateFormatSymbols) formatData; // return symbols.getLeapMonth(cal.get( // ChineseCalendar.IS_LEAP_MONTH)); // } // default: // return super.subFormat(ch, count, beginOffset, pos, formatData, cal); // } // } /// <exclude/> /// <summary> /// /// </summary> /// protected internal override void SubFormat(StringBuilder buf, char ch, int count, int beginOffset, FieldPosition pos, IBM.ICU.Util.Calendar cal) { switch ((int)ch) { case 'G': // 'G' - ERA ZeroPaddingNumber(buf, cal.Get(IBM.ICU.Util.Calendar.ERA), 1, 9); break; case 'l': // 'l' - IS_LEAP_MONTH buf.Append(((ChineseDateFormatSymbols)GetSymbols()) .GetLeapMonth(cal.Get(IBM.ICU.Util.ChineseCalendar.IS_LEAP_MONTH))); break; default: base.SubFormat(buf, ch, count, beginOffset, pos, cal); break; } // TODO: add code to set FieldPosition for 'G' and 'l' fields. This // is a DESIGN FLAW -- subclasses shouldn't have to duplicate the // code that handles this at the end of SimpleDateFormat.subFormat. // The logic should be moved up into SimpleDateFormat.format. }
/// <summary> /// Formats the specified Date into the specified StringBuffer using the /// rules of this DateFormat. If the field specified by the FieldPosition is /// formatted, set the begin and end index of the formatted field in the /// FieldPosition. /// </summary> /// /// <param name="date">the Date to format</param> /// <param name="buffer">the StringBuffer</param> /// <param name="field">the FieldPosition</param> /// <returns>the StringBuffer parameter <c>buffer</c></returns> public abstract StringBuilder Format(DateTime date, StringBuilder buffer, FieldPosition field);
/// <summary> /// Method sets data about field position /// </summary> /// <param name="position"></param> public void SetFieldPosition(FieldPosition position) { SetFieldPosition(position.x, position.y, position.z); }
public override StringBuffer Format(double value, StringBuffer buffer, FieldPosition field) { return new StringBuffer(); }
public void SetFieldPosition(FieldPosition position) { fieldPosition.x = (int)position.x; fieldPosition.y = (int)position.y; Changed(); }
// #endif public override StringBuilder Format(BigDecimal number, StringBuilder toAppendTo, FieldPosition pos) { throw new NotSupportedException( "StringBuffer format(BigDecimal, StringBuffer, FieldPostion) is not implemented"); }
/// <summary> /// Formats the specified object into the specified StringBuffer using the /// pattern of this MessageFormat. /// </summary> /// /// <param name="object">the object to format, must be an array of Object</param> /// <param name="buffer">the StringBuffer</param> /// <param name="field">a FieldPosition which is ignored</param> /// <returns>the StringBuffer parameter <c>buffer</c></returns> /// <exception cref="ClassCastException">when <c>object</c> is not an array of Object</exception> public sealed override StringBuilder FormatObject(Object obj0, StringBuilder buffer, FieldPosition field) { return(Format((Object[])obj0, buffer, field)); }
private StringBuilder FormatImpl(Object[] objects, StringBuilder buffer, FieldPosition position, List <FieldContainer> fields) { FieldPosition passedField = new FieldPosition(0); for (int i = 0; i <= maxOffset; i++) { buffer.Append(strings[i]); int begin = buffer.Length; Object arg; if (objects != null && argumentNumbers[i] < objects.Length) { arg = objects[argumentNumbers[i]]; } else { buffer.Append('{'); buffer.Append(argumentNumbers[i]); buffer.Append('}'); HandleArgumentField(begin, buffer.Length, argumentNumbers[i], position, fields); continue; } Format format = formats[i]; if (format == null || arg == null) { if (arg is object) { format = NumberFormat.GetInstance(); } else if (arg is DateTime) { format = DateFormat.GetInstance(); } else { buffer.Append(arg); HandleArgumentField(begin, buffer.Length, argumentNumbers[i], position, fields); continue; } } if (format is ChoiceFormat) { String result = format.FormatObject(arg); MessageFormat mf = new MessageFormat(result); mf.SetLocale(locale); mf.Format(objects, buffer, passedField); HandleArgumentField(begin, buffer.Length, argumentNumbers[i], position, fields); Handleformat(format, arg, begin, fields); } else { format.FormatObject(arg, buffer, passedField); HandleArgumentField(begin, buffer.Length, argumentNumbers[i], position, fields); Handleformat(format, arg, begin, fields); } } if (maxOffset + 1 < strings.Length) { buffer.Append(strings[maxOffset + 1]); } return(buffer); }
public override StringBuffer Format(long value, StringBuffer stringBuffer, FieldPosition fieldPosition) { var l_hex = Int64.ToHexString(value); if (upperCase) { l_hex = l_hex.ToUpper(); } int l_pad = numDigits - l_hex.Length; l_pad = (0 < l_pad) ? l_pad : 0; var l_extended = new StringBuffer(); for (int i = 0; i < l_pad; i++) { l_extended.Append('0'); } l_extended.Append(l_hex); return(l_extended); }
/// <summary> /// Starts the figure to walk to position /// </summary> /// <param name="position"></param> /// <param name="figure"></param> protected override void MoveFigureObject(FieldPosition position, Figure figure) { Debug.Log("Move Figure Home"); figure.StartWalking(position.transform); }
public override StringBuffer Format(double @double, StringBuffer stringBuffer, FieldPosition fieldPosition) { return(CheckForPositiveExponent(_format.Format(@double, stringBuffer, fieldPosition))); }
/** * Formats a double value to produce a string. In general, the value is * formatted using the formatting rules of <code>format</code>. There are * three exceptions to this: * <ol> * <li>NaN is formatted as '(NaN)'</li> * <li>Positive infinity is formatted as '(Infinity)'</li> * <li>Negative infinity is formatted as '(-Infinity)'</li> * </ol> * * @param value the double to format. * @param format the format used. * @param toAppendTo where the text is to be appended * @param pos On input: an alignment field, if desired. On output: the * offsets of the alignment field * @return the value passed in as toAppendTo. */ public static StringBuilder formatDouble(double value, NumberFormat format, StringBuilder toAppendTo, FieldPosition pos) { if( Double.isNaN(value) || Double.isInfinite(value) ) { toAppendTo.Append('('); toAppendTo.Append(value); toAppendTo.Append(')'); } else { format.format(value, toAppendTo, pos); } return toAppendTo; }
public override StringBuffer Format(long value, StringBuffer stringBuffer, FieldPosition fieldPosition) { var l_hex = Int64.ToHexString(value); if (upperCase) l_hex = l_hex.ToUpper(); int l_pad = numDigits - l_hex.Length; l_pad = (0 < l_pad) ? l_pad : 0; var l_extended = new StringBuffer(); for (int i = 0; i < l_pad; i++) { l_extended.Append('0'); } l_extended.Append(l_hex); return l_extended; }
public override StringBuffer Format(double @double, StringBuffer stringBuffer, FieldPosition fieldPosition) { return Format((long) @double, stringBuffer, fieldPosition); }
public ScriptFieldAttribute(FieldPosition position = FieldPosition.Before) => Position = position;
internal SimpleLogger(string paramString, SimpleDateFormat paramSimpleDateFormat) { this.formatter = paramSimpleDateFormat; this.fieldPosition = new FieldPosition(2); this.printClass = paramString.Substring(paramString.LastIndexOf('.') + 1); }
/// <summary> /// Formats the Object arguments into the specified StringBuffer using the /// pattern of this MessageFormat. /// <p> /// If Field Attribute of the FieldPosition supplied is /// MessageFormat.Field.ARGUMENT, then begin and end index of this field /// position is set to the location of the first occurrence of a message /// format argument. Otherwise the FieldPosition is ignored /// <p> /// </summary> /// /// <param name="objects">the array of Objects to format</param> /// <param name="buffer">the StringBuffer</param> /// <param name="field">a FieldPosition.</param> /// <returns>the StringBuffer parameter <c>buffer</c></returns> public StringBuilder Format(Object[] objects, StringBuilder buffer, FieldPosition field) { return(FormatImpl(objects, buffer, field, null)); }
public override StringBuffer Format(long value, StringBuffer stringBuffer, FieldPosition fieldPosition) { return(CheckForPositiveExponent(base.Format(value, stringBuffer, fieldPosition))); }
// metoda nastavi niektore pozicie ako "dirty" vtedy, // ak tieto su (resp. boli by) v konflikte s poziciou // danou parametrami (row,col,mark) private void setDirtyFlags(int row, int col, int mark) { int i, j, istart, jstart, ipodm, jpodm; /* najprv sa pozrie na cely riadok */ for (j = 0; j < 9; j++) { if ((j != col) && (fields[row, j].Mark == mark)) { FieldPosition pos = canMark(j, row, mark); if (pos == null) { fields[row, j].Dirty = false; } else { fields[row, j].Dirty = true; } } } /* potom sa pozrie na cely stlpec */ for (i = 0; i < 9; i++) { if ((i != row) && (fields[i, col].Mark == mark)) { FieldPosition pos = canMark(col, i, mark); if (pos == null) { fields[i, col].Dirty = false; } else { fields[i, col].Dirty = true; } } } /* potom sa pozrie v malom stvorceku */ istart = row - (row % 3); jstart = col - (col % 3); ipodm = istart + 3; jpodm = jstart + 3; for (i = istart; i < ipodm; i++) { for (j = jstart; j < jpodm; j++) { if (fields[i, j].Mark == mark) { if ((j != col) || (i != row)) { FieldPosition pos = canMark(j, i, mark); if (pos == null) { fields[i, j].Dirty = false; } else { fields[i, j].Dirty = true; } } } } } }
/// <summary> /// Use this for initialization /// </summary> void Awake() { fieldPositions = new FieldPosition[figureCapacity]; InitializeFieldPositions(positions); }
/// <summary> /// Appends to the specified StringBuffer the string associated with the /// range in which the specified long value fits. /// </summary> /// /// <param name="value">the long to format</param> /// <param name="buffer">the StringBuffer</param> /// <param name="field">a FieldPosition which is ignored</param> /// <returns>the StringBuffer parameter <c>buffer</c></returns> public override StringBuilder Format(long value_ren, StringBuilder buffer, FieldPosition field) { return(Format((double)value_ren, buffer, field)); }
public void SelectFieldPosition(FieldPosition position) { UIUtil.DefaultProvider.SelectWithText(this.FieldPositionLocator, StringEnum.GetStringValue(position), LocateBy.Id); }
public LabelAttribute(string callbackName, FieldPosition position) { CallbackName = callbackName; Position = position; }
/// <summary> /// Use this for initialization /// </summary> void Awake() { if (gameObject.transform.parent.name.Equals(parentBenchObject)) isBench = true; else if (gameObject.transform.parent.name.Equals(parentBendObject)) isBend = true; // a regular field has different positions, if there are one or two figures // present. One in the center and further two left an right of the center if (isBend) { fieldPositions = new FieldPosition[figureCapacity]; InitializeFieldPositions(bendPositions); } else { fieldPositions = new FieldPosition[figureCapacity + 1]; InitializeFieldPositions(regularPositions); } }
public static Vector3 GetPhysicalPosition(FieldPosition fieldPosition) { Vector2 value = new Vector2(Config.Instance.gameFieldPosition.x + Config.Instance.zeroTilePosition.x + fieldPosition.x*Config.Instance.tileDistance, Config.Instance.gameFieldPosition.y + Config.Instance.zeroTilePosition.y - fieldPosition.y*Config.Instance.tileDistance); return value; }
/// <summary> /// changes the position from a figure on the same field /// </summary> /// <param name="from"></param> /// <param name="to"></param> private void ChangePosition(FieldPosition from, FieldPosition to) { Figure figure = from.Figure; from.Figure = null; to.Figure = figure; MoveFigureObject(to, figure); }
public override StringBuffer Format(double @double, StringBuffer stringBuffer, FieldPosition fieldPosition) { return(Format((long)@double, stringBuffer, fieldPosition)); }
public Delegate(FieldPosition outerInstance) { this.OuterInstance = outerInstance; }