コード例 #1
0
 public void Format(ScriptWriter sw, IScriptFormatterContext formatterContext, IServices services)
 {
     sw.Append(Value.ToString(CultureInfo.InvariantCulture));
 }
コード例 #2
0
ファイル: PREQEW.cs プロジェクト: rustyworks/OpenVIII
        public override void Format(ScriptWriter sw, IScriptFormatterContext formatterContext, IServices services)
        {
            formatterContext.GetObjectScriptNamesById(_scriptId, out String typeName, out String methodName);

            sw.AppendLine($"{nameof(PREQEW)}(priority: {_priority}, GetObject<{typeName}>().{methodName}());");
        }
コード例 #3
0
 private static String FormatObject(Jsm.GameObject gameObject, ScriptWriter sw, IScriptFormatterContext formatterContext, IServices executionContext)
 {
     gameObject.FormatType(sw, formatterContext, executionContext);
     return(sw.Release());
 }
コード例 #4
0
                public void Format(ScriptWriter sw, IScriptFormatterContext formatterContext, IServices services)
                {
                    String name = formatterContext.GetObjectNameByIndex(_fieldObjectId.Value);

                    sw.Append($"typeof({name})");
                }
コード例 #5
0
 public override void Format(ScriptWriter sw, IScriptFormatterContext formatterContext, IServices services)
 {
     sw.AppendLine("else");
     FormatBranch(sw, formatterContext, services, GetBodyInstructions());
 }
コード例 #6
0
 public void FormatMethodBody(ScriptWriter sw, IScriptFormatterContext formatterContext, IServices executionContext)
 {
     Segment.Format(sw, formatterContext, executionContext);
 }
コード例 #7
0
        public static void FormatAnswers(ScriptWriter sw, String message, IJsmExpression top, IJsmExpression bottom, IJsmExpression begin, IJsmExpression cancel)
        {
            if (!(top is IConstExpression t) || !(bottom is IConstExpression b))
            {
                FormatMonologue(sw, message);
                return;
            }

            if (!sw.HasWhiteLine)
            {
                sw.AppendLine();
            }

            // Question
            //☞ Answer 1
            //   Answer 2
            //   Answer 3
            //☜ Answer 4

            Int32 to = t.Int32();
            Int32 bo = b.Int32();
            Int32 be = -1;
            Int32 ca = -1;

            if (begin is IConstExpression beg)
            {
                be = beg.Int32();
            }

            if (cancel is IConstExpression can)
            {
                ca = can.Int32();
            }

            String[] lines = SplitMonologue(message);

            for (Int32 i = 0; i < lines.Length; i++)
            {
                sw.Append("//");
                if (i >= to && i <= bo)
                {
                    if (i == be)
                    {
                        sw.Append("☞ ");
                    }
                    else if (i == ca)
                    {
                        sw.Append("☜ ");
                    }
                    else
                    {
                        sw.Append("   ");
                    }
                }
                else
                {
                    sw.Append(" ");
                }

                sw.AppendLine(lines[i]);
            }
        }
コード例 #8
0
 public override void Format(ScriptWriter sw, IScriptFormatterContext formatterContext, IServices services)
 {
     // This instruction is part of conditional jumps and isn't exists as is.
 }
コード例 #9
0
 public static Formatter Format(this ScriptWriter sw, IScriptFormatterContext formatterContext, IServices executionContext)
 {
     return(new Formatter(sw, formatterContext, executionContext));
 }
コード例 #10
0
 public Formatter(ScriptWriter sw, IScriptFormatterContext formatterContext, IServices executionContext)
 {
     Sw = sw;
     FormatterContext = formatterContext;
     ExecutionContext = executionContext;
 }
コード例 #11
0
 public void Format(ScriptWriter sw, IScriptFormatterContext formatterContext, IServices services)
 {
     sw.Append($"R{_index.ResultId}");
 }
コード例 #12
0
 public void Format(ScriptWriter sw, IScriptFormatterContext formatterContext, IServices services)
 {
     sw.AppendLine($"goto LABEL{_label};");
 }
コード例 #13
0
 public virtual void Format(ScriptWriter sw, IScriptFormatterContext formatterContext, IServices services)
 {
     FormatItems(sw, formatterContext, services, _list);
 }
コード例 #14
0
 public void Format(ScriptWriter sw, IScriptFormatterContext formatterContext, IServices services)
 {
     sw.Append("!");
     _value.Format(sw, formatterContext, services);
 }
コード例 #15
0
        public static void FormatGlobalGet <T>(GlobalVariableId <T> globalVariable, Int32[] knownVariables, ScriptWriter sw, IScriptFormatterContext formatterContext, IServices executionContext) where T : unmanaged
        {
            if (knownVariables == null || Array.BinarySearch(knownVariables, globalVariable.VariableId) < 0)
            {
                sw.Append("(");
                sw.Append(GlobalVariableId <T> .TypeName);
                sw.Append(")");
                sw.Append("G");
            }
            else
            {
                sw.Append("G");
                sw.Append(GlobalVariableId <T> .TypeName);
            }

            sw.Append("[");
            sw.Append(globalVariable.VariableId.ToString(CultureInfo.InvariantCulture));
            sw.Append("]");
        }
コード例 #16
0
 public void Format(ScriptWriter sw, IScriptFormatterContext formatterContext, IServices services)
 {
     FormatHelper.FormatGlobalGet(_globalVariable, Jsm.GlobalUInt32, sw, formatterContext, services);
 }
コード例 #17
0
 public override void Format(ScriptWriter sw, IScriptFormatterContext formatterContext, IServices services)
 {
     FormatHelper.FormatGlobalSet(_globalVariable, _value, Jsm.GlobalUInt16, sw, formatterContext, services);
 }