예제 #1
0
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            TES5StaticReference     newCalledOn = TES5StaticReferenceFactory.Game;
            TES5ObjectCallArguments arguments   = objectCallArgumentsFactory.CreateArgumentList(function.Arguments, codeScope, globalScope, multipleScriptsScope);

            return(this.objectCallFactory.CreateObjectCall(newCalledOn, "PlayBink", arguments));
        }
예제 #2
0
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            TES5LocalScope        localScope        = codeScope.LocalScope;
            TES4FunctionArguments functionArguments = function.Arguments;

            //todo Refactor - add floating point vars .
            if (functionArguments.Count == 1)
            {
                TES5StaticReference calledOnRef = TES5StaticReferenceFactory.Debug;
                return(this.objectCallFactory.CreateObjectCall(calledOnRef, "MessageBox", this.objectCallArgumentsFactory.CreateArgumentList(functionArguments, codeScope, globalScope, multipleScriptsScope)));
            }
            else
            {
                string[]             stringArguments  = functionArguments.Select(v => v.StringValue).ToArray();
                string               edid             = messageBoxData.GetEDID(stringArguments);
                IEnumerable <string> messageArguments = (new string[] { edid }).Concat(functionArguments.Select(a => a.StringValue));
                this.metadataLogService.WriteLine("ADD_MESSAGE", messageArguments);
                Nullable <int> tes5FormIDNullable = messageBoxData.GetTES5FormID(edid);
                TES5Property   messageBoxProperty = TES5PropertyFactory.ConstructWithTES5FormID(edid, TES5BasicType.T_MESSAGE, edid, tes5FormIDNullable);
                globalScope.AddProperty(messageBoxProperty);
                ITES5Referencer messageBoxReference = TES5ReferenceFactory.CreateReferenceToVariableOrProperty(messageBoxProperty);
                TES5ObjectCall  messageBoxShow      = this.objectCallFactory.CreateObjectCall(messageBoxReference, "Show");
                ITES5Referencer messageBoxResult    = this.referenceFactory.CreateReadReference(TES5ReferenceFactory.MESSAGEBOX_VARIABLE_CONST, globalScope, multipleScriptsScope, localScope);
                return(TES5VariableAssignationFactory.CreateAssignation(messageBoxResult, messageBoxShow));
            }
        }
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            TES5LocalScope        localScope        = codeScope.LocalScope;
            TES4FunctionArguments functionArguments = function.Arguments;

            //todo Refactor - add floating point vars .
            if (functionArguments.Count == 1)
            {
                TES5StaticReference calledOnRef = TES5StaticReference.Debug;
                return(this.objectCallFactory.CreateObjectCall(calledOnRef, "MessageBox", multipleScriptsScope, this.objectCallArgumentsFactory.CreateArgumentList(functionArguments, codeScope, globalScope, multipleScriptsScope)));
            }
            else
            {
                string edid = NameTransformer.GetEscapedName(string.Join("", functionArguments.Select(v => v.StringValue)), TES5TypeFactory.TES4Prefix + "MessageBox_", true);//WTM:  Change:  PHPFunction.MD5(PHPFunction.Serialize(functionArguments.getValues()))
                IEnumerable <string> messageArguments = (new string[] { edid }).Concat(functionArguments.Select(a => a.StringValue));
                this.metadataLogService.WriteLine("ADD_MESSAGE", messageArguments);
                ITES5Referencer messageBoxResult = this.referenceFactory.CreateReadReference(TES5ReferenceFactory.MESSAGEBOX_VARIABLE_CONST, globalScope, multipleScriptsScope, localScope);
                ITES5Referencer reference        = this.referenceFactory.CreateReadReference(edid, globalScope, multipleScriptsScope, localScope);
                return(TES5VariableAssignationFactory.CreateAssignation(messageBoxResult, this.objectCallFactory.CreateObjectCall(reference, "show", multipleScriptsScope)));
            }
        }