コード例 #1
0
ファイル: SnapDescriptor.cs プロジェクト: RHY3756547/FreeSO
 public override Dictionary<int, string> GetNamedProperties(EditorScope scope, VMPrimitiveOperand operand)
 {
     var map = new Dictionary<int, string>();
     var op = (VMSnapOperand)operand;
     switch (op.Mode)
     {
         case VMSnapSlotScope.Global:
             var gslots = scope.GetResource<STR>(257, ScopeSource.Global);
             for (int i = 0; i < gslots.Length; i++)
                 map.Add(i, gslots.GetString(i));
             return map;
         case VMSnapSlotScope.Literal:
             var slotNs = scope.GetResource<STR>(257, ScopeSource.Private);
             var slotRes = scope.GetResource<SLOT>(scope.GetOBJD().SlotID, ScopeSource.Private);
             if (slotRes == null) return map;
             var slots = slotRes.Slots[3];
             for (int i = 0; i < slots.Count; i++)
                 map.Add(i, (slotNs != null && slotNs.GetString(i) != null)?slotNs.GetString(i):"slot "+i);
             return map;
         case VMSnapSlotScope.StackVariable:
             var str = scope.GetVarScopeDataNames(VMVariableScope.Parameters);
             for (int i = 0; i < str.Count; i++)
                 map.Add(str[i].Value, str[i].Name);
             return map;
         default:
             map.Add(0, "---");
             return map;
     }
 }
コード例 #2
0
        public override string GetBody(EditorScope scope)
        {
            var op     = (VMSnapOperand)Operand;
            var result = new StringBuilder();


            switch (op.Mode)
            {
            case VMSnapSlotScope.Global:
                var gslots = scope.GetResource <STR>(257, ScopeSource.Global);
                result.Append(gslots?.GetString(op.Index) ?? "Global slot " + op.Index);
                break;

            case VMSnapSlotScope.Literal:
                var slotNs = scope.GetResource <STR>(257, ScopeSource.Private);
                result.Append((slotNs != null && slotNs.GetString(op.Index) != null) ? slotNs.GetString(op.Index) : "Private slot " + op.Index);
                break;

            case VMSnapSlotScope.StackVariable:
                result.Append("Private slot indexed by " + scope.GetVarName(VMVariableScope.Parameters, (short)op.Index));
                break;

            case VMSnapSlotScope.BeContained:
                result.Append("Be contained in Stack Object");
                break;

            case VMSnapSlotScope.InFront:
                result.Append("In front of Stack Object");
                break;
            }

            //if (op.NoFailureTrees) result.Append("\r\n(No Failure Trees)");

            return(result.ToString());
        }
コード例 #3
0
        public override string GetBody(EditorScope scope)
        {
            var op     = (VMGotoRoutingSlotOperand)Operand;
            var result = new StringBuilder();

            switch (op.Type)
            {
            case VMSlotScope.Global:
                var gslots = scope.GetResource <STR>(257, ScopeSource.Global);
                result.Append(gslots?.GetString(op.Data) ?? ("Global slot " + op.Data));
                break;

            case VMSlotScope.Literal:
                var slotNs = scope.GetResource <STR>(257, ScopeSource.Private);
                result.Append((slotNs != null && slotNs.GetString(op.Data) != null) ? slotNs.GetString(op.Data) : "Private slot " + op.Data);
                break;

            case VMSlotScope.StackVariable:
                result.Append("Private slot indexed by " + scope.GetVarName(VMVariableScope.Parameters, (short)op.Data));
                break;
            }

            if (op.NoFailureTrees)
            {
                result.Append("\r\n(No Failure Trees)");
            }

            return(result.ToString());
        }
コード例 #4
0
        public override Dictionary <int, string> GetNamedProperties(EditorScope scope, VMPrimitiveOperand operand)
        {
            var map = new Dictionary <int, string>();
            var op  = (VMSnapOperand)operand;

            switch (op.Mode)
            {
            case VMSnapSlotScope.Global:
                var gslots = scope.GetResource <STR>(257, ScopeSource.Global);
                if (gslots == null)
                {
                    var gslotsres = scope.GetResource <SLOT>(100,ScopeSource.Global);
                    for (int i = 0; i < gslotsres.Chronological.Count; i++)
                    {
                        map.Add(i,i.ToString());
                    }
                }
                else
                {
                    for (int i = 0; i < gslots.Length; i++)
                    {
                        map.Add(i, gslots.GetString(i));
                    }
                }
                return(map);

            case VMSnapSlotScope.Literal:
                var slotNs  = scope.GetResource <STR>(257, ScopeSource.Private);
                var slotRes = scope.GetResource <SLOT>(scope.GetOBJD().SlotID,ScopeSource.Private);
                if (slotRes == null || !slotRes.Slots.ContainsKey(3))
                {
                    return(map);
                }
                var slots = slotRes.Slots[3];
                for (int i = 0; i < slots.Count; i++)
                {
                    map.Add(i,(slotNs != null && slotNs.GetString(i) != null)?slotNs.GetString(i):"slot " + i);
                }
                return(map);

            case VMSnapSlotScope.StackVariable:
                var str = scope.GetVarScopeDataNames(VMVariableScope.Parameters);
                for (int i = 0; i < str.Count; i++)
                {
                    map.Add(str[i].Value,str[i].Name);
                }
                return(map);

            default:
                map.Add(0,"---");
                return(map);
            }
        }
コード例 #5
0
        public override string GetBody(EditorScope scope)
        {
            var op     = (VMPlaySoundOperand)Operand;
            var result = new StringBuilder();

            result.Append("Play \"");
            var fwav = scope.GetResource <FWAV>(op.EventID, ScopeSource.Private);

            if (fwav == null)
            {
                fwav = scope.GetResource <FWAV>(op.EventID, ScopeSource.SemiGlobal);
            }
            if (fwav == null)
            {
                fwav = scope.GetResource <FWAV>(op.EventID, ScopeSource.Global);
            }
            result.Append((fwav == null)?"*Event Missing!*":fwav.Name);
            result.Append("\"");

            var    flagStr = new StringBuilder();
            string prepend = "";

            if (op.Loop)
            {
                flagStr.Append("Loop"); prepend = ", ";
            }
            if (op.NoPan)
            {
                flagStr.Append(prepend + "No Pan"); prepend = ", ";
            }
            if (op.NoZoom)
            {
                flagStr.Append(prepend + "No Zoom"); prepend = ", ";
            }
            if (op.StackObjAsSource)
            {
                flagStr.Append(prepend + "Stack Object as Source"); prepend = ", ";
            }

            if (flagStr.Length != 0)
            {
                result.Append("\r\n(");
                result.Append(flagStr);
                result.Append(")");
            }

            return(result.ToString());
        }
コード例 #6
0
        public void OperandUpdated()
        {
            var op   = Operand;
            var fwav = Scope.GetResource <FWAV>(op.EventID, ScopeSource.Private);

            ObjectLabel.Text = (fwav == null) ? "*Event Missing!*" : fwav.Name;
        }
コード例 #7
0
        public override string GetBody(EditorScope scope)
        {
            var op = (VMPlaySoundOperand)Operand;
            var result = new StringBuilder();

            result.Append("Play \"");
            var fwav = scope.GetResource<FWAV>(op.EventID, ScopeSource.Private);
            result.Append((fwav == null)?"*Event Missing!*":fwav.Name);
            result.Append("\"");

            var flagStr = new StringBuilder();
            string prepend = "";
            if (op.Loop) { flagStr.Append("Loop"); prepend = ", "; }
            if (op.NoPan) { flagStr.Append(prepend + "No Pan"); prepend = ", "; }
            if (op.NoZoom) { flagStr.Append(prepend + "No Zoom"); prepend = ", "; }
            if (op.StackObjAsSource) { flagStr.Append(prepend + "Stack Object as Source"); prepend = ", "; }

            if (flagStr.Length != 0)
            {
                result.Append("\r\n(");
                result.Append(flagStr);
                result.Append(")");
            }

            return result.ToString();
        }
コード例 #8
0
        public override Dictionary <int, string> GetNamedProperties(EditorScope scope, VMPrimitiveOperand operand)
        {
            var map = new Dictionary <int, string>();
            var op  = (VMGotoRoutingSlotOperand)operand;

            switch (op.Type)
            {
            case VMSlotScope.Global:
                var gslots = scope.GetResource <STR>(257, ScopeSource.Global);
                if (gslots == null)
                {
                    return(map);
                }
                for (int i = 0; i < gslots.Length; i++)
                {
                    map.Add(i, gslots.GetString(i));
                }
                return(map);

            case VMSlotScope.Literal:
                var slotNs  = scope.GetResource <STR>(257, ScopeSource.Private);
                var slotRes = scope.GetResource <SLOT>(scope.GetOBJD().SlotID,ScopeSource.Private);
                if (slotRes == null)
                {
                    return(map);
                }
                var slots = slotRes.Slots[3];
                for (int i = 0; i < slots.Count; i++)
                {
                    map.Add(i,(slotNs != null && slotNs.GetString(i) != null)?slotNs.GetString(i):"slot " + i);
                }
                return(map);

            case VMSlotScope.StackVariable:
                var str = scope.GetVarScopeDataNames(VMVariableScope.Parameters);
                for (int i = 0; i < str.Count; i++)
                {
                    map.Add(str[i].Value,str[i].Name);
                }
                return(map);

            default:
                return(map);
            }
        }
コード例 #9
0
 public static STR GetAnimTable(EditorScope escope, VMAnimationScope scope)
 {
     switch (scope)
     {
         case VMAnimationScope.Object:
             var anitableID = escope.GetOBJD().AnimationTableID;
             var table = escope.GetResource<STR>(anitableID, ScopeSource.Private);
             if (table == null) table = escope.GetResource<STR>(129, ScopeSource.Private);
             return table;
         case VMAnimationScope.Misc:
             return EditorScope.Globals.Resource.Get<STR>(156);
         case VMAnimationScope.PersonStock:
             return EditorScope.Globals.Resource.Get<STR>(130);
         case VMAnimationScope.Global:
             return EditorScope.Globals.Resource.Get<STR>(128);
     }
     return null;
 }
コード例 #10
0
        public static STR GetAnimTable(EditorScope escope, VMAnimationScope scope)
        {
            switch (scope)
            {
            case VMAnimationScope.Object:
                var anitableID = escope.GetOBJD().AnimationTableID;
                var table      = escope.GetResource <STR>(anitableID, ScopeSource.Private);
                if (table == null)
                {
                    table = escope.GetResource <STR>(129, ScopeSource.Private);
                }
                return(table);

            case VMAnimationScope.Misc:
                return(EditorScope.Globals.Resource.Get <STR>(156));

            case VMAnimationScope.PersonStock:
                return(EditorScope.Globals.Resource.Get <STR>(130));

            case VMAnimationScope.Global:
                return(EditorScope.Globals.Resource.Get <STR>(128));
            }
            return(null);
        }
コード例 #11
0
        public override string GetBody(EditorScope scope)
        {
            var op = (VMGotoRoutingSlotOperand)Operand;
            var result = new StringBuilder();

            switch (op.Type)
            {
                case VMSlotScope.Global:
                    var gslots = scope.GetResource<STR>(257, ScopeSource.Global);
                    result.Append(gslots.GetString(op.Data));
                    break;
                case VMSlotScope.Literal:
                    var slotNs = scope.GetResource<STR>(257, ScopeSource.Private);
                    result.Append((slotNs != null && slotNs.GetString(op.Data) != null) ? slotNs.GetString(op.Data) : "Private slot " + op.Data);
                    break;
                case VMSlotScope.StackVariable:
                    result.Append("Private slot indexed by " + scope.GetVarName(VMVariableScope.Parameters, (short)op.Data));
                    break;
            }

            if (op.NoFailureTrees) result.Append("\r\n(No Failure Trees)");

            return result.ToString();
        }
コード例 #12
0
        public override string GetBody(EditorScope scope)
        {
            var op     = (VMChangeActionStringOperand)Operand;
            var result = new StringBuilder();

            var str = scope.GetResource <STR>(op.StringTable, (ScopeSource)op.Scope);

            if (str == null)
            {
                result.Append("String #" + op.StringID + " in " + ((ScopeSource)op.Scope).ToString() + " STR#" + op.StringTable);
            }
            else
            {
                result.Append(str.GetString(op.StringID - 1));
            }

            return(result.ToString());
        }
コード例 #13
0
        public override string GetBody(EditorScope scope)
        {
            var op     = (VMRunTreeByNameOperand)Operand;
            var result = new StringBuilder();

            var str = scope.GetResource <STR>(op.StringTable, (op.StringScope == 1) ? ScopeSource.Global : ScopeSource.Private);

            result.Append(EditorScope.Behaviour.Get <STR>(222).GetString(op.Destination) + "\r\n");

            if (str == null)
            {
                result.Append("(Tree #" + op.StringID + " in " + ((op.StringScope == 1)?"global":"local") + " STR#" + op.StringTable + ")");
            }
            else
            {
                result.Append("(" + str.GetString(Math.Max(0, op.StringID - 1)) + ")");
            }

            return(result.ToString());
        }
コード例 #14
0
ファイル: SnapDescriptor.cs プロジェクト: RHY3756547/FreeSO
        public override string GetBody(EditorScope scope)
        {
            var op = (VMSnapOperand)Operand;
            var result = new StringBuilder();

            switch (op.Mode)
            {
                case VMSnapSlotScope.Global:
                    var gslots = scope.GetResource<STR>(257, ScopeSource.Global);
                    result.Append(gslots.GetString(op.Index));
                    break;
                case VMSnapSlotScope.Literal:
                    var slotNs = scope.GetResource<STR>(257, ScopeSource.Private);
                    result.Append((slotNs != null && slotNs.GetString(op.Index) != null) ? slotNs.GetString(op.Index) : "Private slot " + op.Index);
                    break;
                case VMSnapSlotScope.StackVariable:
                    result.Append("Private slot indexed by " + scope.GetVarName(VMVariableScope.Parameters, (short)op.Index));
                    break;
                case VMSnapSlotScope.BeContained:
                    result.Append("Be contained in Stack Object");
                    break;
                case VMSnapSlotScope.InFront:
                    result.Append("In front of Stack Object");
                    break;
            }

            //if (op.NoFailureTrees) result.Append("\r\n(No Failure Trees)");

            return result.ToString();
        }
コード例 #15
0
        public override string GetBody(EditorScope scope)
        {
            var op     = (VMDialogOperand)Operand;
            var result = new StringBuilder();

            result.Append("Type: " + op.Type.ToString() + "\r\n");

            var flagStr = new StringBuilder();

            STR source;

            switch (PrimID)
            {
            case 38:
                source = scope.GetResource <STR>(301, ScopeSource.Global); break;

            case 39:
                source = scope.GetResource <STR>(301, ScopeSource.SemiGlobal); break;

            default:
                source = scope.GetResource <STR>(301, ScopeSource.Private); break;
            }

            if (source == null)
            {
                result.Append("String Table #301 Missing!");
            }
            else
            {
                string rprepend = "";
                if (op.TitleStringID > 0)
                {
                    result.Append("[" + source.GetString(op.TitleStringID - 1) + "]"); rprepend = "\r\n";
                }
                ;
                if (op.MessageStringID > 0)
                {
                    result.Append(rprepend + source.GetString(op.MessageStringID - 1)); rprepend = "\r\n";
                }
                ;

                var def = new string[] { "Yes", "No", "Cancel" };
                var answers = new byte[] { op.YesStringID, op.NoStringID, op.CancelStringID }.Zip(def, (x, defn) => (x == 0) ? defn : source.GetString(x - 1)).ToList();

                switch (op.Type)
                {
                case VMDialogType.Message:
                    answers = new List <string>()
                    {
                        (op.YesStringID == 0) ? "OK" : answers[0]
                    }; break;

                case VMDialogType.YesNo:
                    answers.RemoveAt(2); break;

                case VMDialogType.YesNoCancel:
                    break;

                default:
                    answers.Clear(); break;
                }

                result.Append(rprepend);
                if (answers.Count > 0)
                {
                    result.Append("(");
                    for (int i = 0; i < answers.Count; i++)
                    {
                        result.Append(answers[i]);
                        if (i + 1 < answers.Count)
                        {
                            result.Append(", ");
                        }
                    }
                    result.Append(")");
                }
            }

            string prepend = "";

            if (op.Continue)
            {
                flagStr.Append("Non-blocking"); prepend = ", ";
            }
            if (op.UseTemp1)
            {
                flagStr.Append(prepend + "UseTemp1"); prepend = ", ";
            }
            if (op.UseTempXL)
            {
                flagStr.Append(prepend + "UseTempXL"); prepend = ", ";
            }

            if (flagStr.Length != 0)
            {
                result.Append("\r\n(");
                result.Append(flagStr);
                result.Append(")");
            }

            return(result.ToString());
        }