コード例 #1
0
ファイル: HttpModule.cs プロジェクト: BrookHuang/XYFrame
        public void Init(HttpApplication context)
        {
            System.Xml.XmlDocument _document = new System.Xml.XmlDocument();
            _document.Load(Xy.Tools.IO.File.foundConfigurationFile("App", Xy.AppSetting.FILE_EXT));
            foreach (System.Xml.XmlNode _item in _document.GetElementsByTagName("Global")) {
                string _className = _item.InnerText;
                Type _tempCtonrlType = Type.GetType(_className, false, true);
                IGlobal _tempGlobal;
                if (_tempCtonrlType == null) {
                    System.Reflection.Assembly asm = System.Reflection.Assembly.Load(_className.Split(',')[0]);
                    _tempCtonrlType = asm.GetType(_className.Split(',')[1], false, true);
                }
                _tempGlobal = System.Activator.CreateInstance(_tempCtonrlType) as IGlobal;
                if (_tempGlobal != null) {
                    global = _tempGlobal;
                }
            }
            if (global == null) { global = new EmptyGlobal(); }
            global.ApplicationInit(context);

            context.BeginRequest += new EventHandler(context_BeginRequest);
            context.Error += new EventHandler(context_Error);
            context.EndRequest += new EventHandler(context_EndRequest);
            _urlManager = URLManage.URLManager.GetInstance();
        }
コード例 #2
0
ファイル: NativeMethodOverload.cs プロジェクト: cosh/Jint
        public NativeMethodOverload(ICollection<MethodInfo> methods , JsObject prototype, IGlobal global)
            : base(prototype)
        {
            if (global == null)
                throw new ArgumentNullException("global");
            m_marshaller = global.Marshaller;

            foreach (MethodInfo info in methods)
            {
                Name = info.Name;
                break;
            }

            foreach (var method in methods)
            {
                if (method.IsGenericMethodDefinition)
                    m_generics.AddLast(method);
                else if (! method.ContainsGenericParameters)
                    m_methods.AddLast(method);
            }

            m_overloads = new NativeOverloadImpl<MethodInfo, JsMethodImpl>(
                m_marshaller,
                new NativeOverloadImpl<MethodInfo, JsMethodImpl>.GetMembersDelegate(this.GetMembers),
                new NativeOverloadImpl<MethodInfo, JsMethodImpl>.WrapMmemberDelegate(this.WrapMember)
            );
        }
コード例 #3
0
        public JsErrorConstructor(IGlobal global, string errorType)
            : base(global) {
            this.errorType = errorType;
            Name = errorType;

            DefineOwnProperty(PROTOTYPE, global.ObjectClass.New(this), PropertyAttributes.DontEnum | PropertyAttributes.DontDelete | PropertyAttributes.ReadOnly);
        }
コード例 #4
0
        public MaxSceneServerUtilityDescriptor(IGlobal global)
        {
            this.global = global;

            // The two numbers used for class id have to be unique/random
            classID = global.Class_ID.Create(681601651, 1321680997);
        }
コード例 #5
0
ファイル: MaxBridgePlugin.cs プロジェクト: sebjf/dazmaxbridge
 public MaxPlugin(IGlobal globalinterface)
 {
     this.gi = globalinterface;
     RebuildMaterials = false;
     RemoveTransparentFaces = true;
     Templates = new MaterialLibraryView(Defaults.MaterialLibraryFilename);
 }
コード例 #6
0
        public override void InitPrototype(IGlobal global) {
            var Prototype = PrototypeProperty;

            Prototype.DefineOwnProperty(new PropertyDescriptor<JsObject>(global, Prototype, "length", GetLengthImpl, SetLengthImpl) { Enumerable = false });

            Prototype.DefineOwnProperty("toString", global.FunctionClass.New<JsArray>(ToStringImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("toLocaleString", global.FunctionClass.New<JsArray>(ToLocaleStringImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("concat", global.FunctionClass.New<JsObject>(Concat), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("join", global.FunctionClass.New<JsObject>(Join, 1), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("pop", global.FunctionClass.New<JsObject>(Pop), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("push", global.FunctionClass.New<JsObject>(Push, 1), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("reverse", global.FunctionClass.New<JsObject>(Reverse), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("shift", global.FunctionClass.New<JsObject>(Shift), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("slice", global.FunctionClass.New<JsObject>(Slice, 2), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("sort", global.FunctionClass.New<JsObject>(Sort), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("splice", global.FunctionClass.New<JsObject>(Splice, 2), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("unshift", global.FunctionClass.New<JsObject>(UnShift, 1), PropertyAttributes.DontEnum);

            Prototype.DefineOwnProperty("indexOf", global.FunctionClass.New<JsObject>(IndexOfImpl, 1), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("lastIndexOf", global.FunctionClass.New<JsObject>(LastIndexOfImpl, 1), PropertyAttributes.DontEnum);

            if (global.HasOption(Options.Ecmascript5)) {
                Prototype.DefineOwnProperty("forEach", global.FunctionClass.New<JsObject>(ForEach, 2), PropertyAttributes.DontEnum);
            }
        }
コード例 #7
0
ファイル: Loader.cs プロジェクト: culeaalex/Babylon.js
 public static void AssemblyMain()
 {
     Global = GlobalInterface.Instance;
     Core = Global.COREInterface14;
     Class_ID = Global.Class_ID.Create(0x8217f123, 0xef980456);
     Core.AddClass(new Descriptor());
 }
コード例 #8
0
        public override void InitPrototype(IGlobal global) {
            var Prototype = PrototypeProperty;

            Prototype.DefineOwnProperty("split", global.FunctionClass.New<JsDictionaryObject>(SplitImpl, 2), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("replace", global.FunctionClass.New<JsDictionaryObject>(ReplaceImpl, 2), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("toString", global.FunctionClass.New<JsDictionaryObject>(ToStringImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("toLocaleString", global.FunctionClass.New<JsDictionaryObject>(ToStringImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("match", global.FunctionClass.New<JsDictionaryObject>(MatchFunc), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("localeCompare", global.FunctionClass.New<JsDictionaryObject>(LocaleCompareImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("substring", global.FunctionClass.New<JsDictionaryObject>(SubstringImpl, 2), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("substr", global.FunctionClass.New<JsDictionaryObject>(SubstrImpl, 2), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("search", global.FunctionClass.New<JsDictionaryObject>(SearchImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("valueOf", global.FunctionClass.New<JsString>(ValueOfImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("concat", global.FunctionClass.New<JsDictionaryObject>(ConcatImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("charAt", global.FunctionClass.New<JsDictionaryObject>(CharAtImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("charCodeAt", global.FunctionClass.New<JsDictionaryObject>(CharCodeAtImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("lastIndexOf", global.FunctionClass.New<JsDictionaryObject>(LastIndexOfImpl, 1), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("indexOf", global.FunctionClass.New<JsDictionaryObject>(IndexOfImpl, 1), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("toLowerCase", global.FunctionClass.New<JsDictionaryObject>(ToLowerCaseImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("toLocaleLowerCase", global.FunctionClass.New<JsDictionaryObject>(ToLocaleLowerCaseImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("toUpperCase", global.FunctionClass.New<JsDictionaryObject>(ToUpperCaseImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("toLocaleUpperCase", global.FunctionClass.New<JsDictionaryObject>(ToLocaleUpperCaseImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("slice", global.FunctionClass.New<JsDictionaryObject>(SliceImpl, 2), PropertyAttributes.DontEnum);

            #region Properties
            Prototype.DefineOwnProperty(new PropertyDescriptor<JsDictionaryObject>(global, Prototype, "length", LengthImpl));
            #endregion
        }
コード例 #9
0
ファイル: JsMathConstructor.cs プロジェクト: pusp/o2platform
        public JsMathConstructor(IGlobal global)
        {
            Global = global;

            #region Functions
            this["abs"] = new ClrFunction(new Func<double, JsNumber>((d) => { return Global.NumberClass.New(Math.Abs(d)); }));
            this["acos"] = new ClrFunction(new Func<double, JsNumber>((d) => { return Global.NumberClass.New(Math.Acos(d)); }));
            this["asin"] = new ClrFunction(new Func<double, JsNumber>((d) => { return Global.NumberClass.New(Math.Asin(d)); }));
            this["atan"] = new ClrFunction(new Func<double, JsNumber>((d) => { return Global.NumberClass.New(Math.Atan(d)); }));
            this["atan2"] = new ClrFunction(new Func<double, double, JsNumber>((y, x) => { return Global.NumberClass.New(Math.Atan2(y, x)); }));
            this["ceil"] = new ClrFunction(new Func<double, JsNumber>((d) => { return Global.NumberClass.New(Math.Ceiling(d)); }));
            this["cos"] = new ClrFunction(new Func<double, JsNumber>((d) => { return Global.NumberClass.New(Math.Cos(d)); }));
            this["exp"] = new ClrFunction(new Func<double, JsNumber>((d) => { return Global.NumberClass.New(Math.Exp(d)); }));
            this["floor"] = new ClrFunction(new Func<double, JsNumber>((d) => { return Global.NumberClass.New(Math.Floor(d)); }));
            this["log"] = new ClrFunction(new Func<double, JsNumber>((d) => { return Global.NumberClass.New(Math.Log(d)); }));
            this["max"] = new ClrFunction(new Func<double, double, JsNumber>((a, b) => { return Global.NumberClass.New(Math.Max(a, b)); }));
            this["min"] = new ClrFunction(new Func<double, double, JsNumber>((a, b) => { return Global.NumberClass.New(Math.Min(a, b)); }));
            this["pow"] = new ClrFunction(new Func<double, double, JsNumber>((a, b) => { return Global.NumberClass.New(Math.Pow(a, b)); }));
            this["random"] = global.FunctionClass.New(new Func<double>(() => { return new Random(DateTime.Now.Millisecond).NextDouble(); }));
            this["round"] = new ClrFunction(new Func<double, JsNumber>((d) => { return Global.NumberClass.New(Math.Round(d)); }));
            this["sin"] = new ClrFunction(new Func<double, JsNumber>((d) => { return Global.NumberClass.New(Math.Sin(d)); }));
            this["sqrt"] = new ClrFunction(new Func<double, JsNumber>((d) => { return Global.NumberClass.New(Math.Sqrt(d)); }));
            this["tan"] = new ClrFunction(new Func<double, JsNumber>((d) => { return Global.NumberClass.New(Math.Tan(d)); }));
            #endregion

            this["E"] = global.NumberClass.New(Math.E);
            this["LN2"] = global.NumberClass.New(Math.Log(2));
            this["LN10"] = global.NumberClass.New(Math.Log(10));
            this["LOG2E"] = global.NumberClass.New(Math.Log(Math.E, 2));
            this["PI"] = global.NumberClass.New(Math.PI);
            this["SQRT1_2"] = global.NumberClass.New(Math.Sqrt(0.5));
            this["SQRT2"] = global.NumberClass.New(Math.Sqrt(2));
        }
コード例 #10
0
ファイル: JsMathConstructor.cs プロジェクト: cosh/Jint
        public JsMathConstructor(IGlobal global)
            : base(global.ObjectClass.PrototypeProperty)
        {
            Global = global;
            var random = new Random();

            #region Functions
            this["abs"] = global.FunctionClass.New(new Delegates.Func<double, JsNumber>(d => Global.NumberClass.New(Math.Abs(d))));
            this["acos"] = global.FunctionClass.New(new Delegates.Func<double, JsNumber>(d => Global.NumberClass.New(Math.Acos(d))));
            this["asin"] = global.FunctionClass.New(new Delegates.Func<double, JsNumber>(d => Global.NumberClass.New(Math.Asin(d))));
            this["atan"] = global.FunctionClass.New(new Delegates.Func<double, JsNumber>(d => Global.NumberClass.New(Math.Atan(d))));
            this["atan2"] = global.FunctionClass.New(new Delegates.Func<double, double, JsNumber>((y, x) => Global.NumberClass.New(Math.Atan2(y, x))));
            this["ceil"] = global.FunctionClass.New(new Delegates.Func<double, JsNumber>(d => Global.NumberClass.New(Math.Ceiling(d))));
            this["cos"] = global.FunctionClass.New(new Delegates.Func<double, JsNumber>(d => Global.NumberClass.New(Math.Cos(d))));
            this["exp"] = global.FunctionClass.New(new Delegates.Func<double, JsNumber>(d => Global.NumberClass.New(Math.Exp(d))));
            this["floor"] = global.FunctionClass.New(new Delegates.Func<double, JsNumber>(d => Global.NumberClass.New(Math.Floor(d))));
            this["log"] = global.FunctionClass.New(new Delegates.Func<double, JsNumber>(d => Global.NumberClass.New(Math.Log(d))));
            this["max"] = global.FunctionClass.New(new Delegates.Func<double, double, JsNumber>((a, b) => Global.NumberClass.New(Math.Max(a, b))));
            this["min"] = global.FunctionClass.New(new Delegates.Func<double, double, JsNumber>((a, b) => Global.NumberClass.New(Math.Min(a, b))));
            this["pow"] = global.FunctionClass.New(new Delegates.Func<double, double, JsNumber>((a, b) => Global.NumberClass.New(Math.Pow(a, b))));
            this["random"] = global.FunctionClass.New(new Delegates.Func<double>(random.NextDouble));
            this["round"] = global.FunctionClass.New(new Delegates.Func<double, JsNumber>(d => Global.NumberClass.New(Math.Round(d))));
            this["sin"] = global.FunctionClass.New(new Delegates.Func<double, JsNumber>(d => Global.NumberClass.New(Math.Sin(d))));
            this["sqrt"] = global.FunctionClass.New(new Delegates.Func<double, JsNumber>(d => Global.NumberClass.New(Math.Sqrt(d))));
            this["tan"] = global.FunctionClass.New(new Delegates.Func<double, JsNumber>(d => Global.NumberClass.New(Math.Tan(d))));
            #endregion

            this["E"] = global.NumberClass.New(Math.E);
            this["LN2"] = global.NumberClass.New(Math.Log(2));
            this["LN10"] = global.NumberClass.New(Math.Log(10));
            this["LOG2E"] = global.NumberClass.New(Math.Log(Math.E, 2));
            this["PI"] = global.NumberClass.New(Math.PI);
            this["SQRT1_2"] = global.NumberClass.New(Math.Sqrt(0.5));
            this["SQRT2"] = global.NumberClass.New(Math.Sqrt(2));
        }
コード例 #11
0
        public JsStringConstructor(IGlobal global)
            : base(global) {
            DefineOwnProperty(PROTOTYPE, global.ObjectClass.New(this), PropertyAttributes.ReadOnly | PropertyAttributes.DontDelete | PropertyAttributes.DontEnum);
            Name = "String";

            this["fromCharCode"] = global.FunctionClass.New<JsDictionaryObject>(FromCharCodeImpl);
        }
コード例 #12
0
ファイル: JsObject.cs プロジェクト: 925coder/ravendb
        public override JsInstance ToPrimitive(IGlobal global) {
            if (Value != null && ! (Value is IComparable) )
                return global.StringClass.New(Value.ToString());

            switch (Convert.GetTypeCode(Value)) {
                case TypeCode.Boolean:
                    return global.BooleanClass.New((bool)Value);
                case TypeCode.Char:
                case TypeCode.String:
                case TypeCode.Object:
                    return global.StringClass.New(Value.ToString());
                case TypeCode.DateTime:
                    return global.StringClass.New(JsDate.DateToString((DateTime)Value));
                case TypeCode.Byte:
                case TypeCode.Int16:
                case TypeCode.Int32:
                case TypeCode.Int64:
                case TypeCode.SByte:
                case TypeCode.UInt16:
                case TypeCode.UInt32:
                case TypeCode.UInt64:
                case TypeCode.Decimal:
                case TypeCode.Double:
                case TypeCode.Single:
                    return global.NumberClass.New(Convert.ToDouble(Value));
                default:
                    return JsUndefined.Instance;
            }

        }
コード例 #13
0
ファイル: JsArguments.cs プロジェクト: Fedorm/core-master
        public JsArguments(IGlobal global, JsFunction callee, JsInstance[] arguments)
            : base()
        {
			this.args = arguments;
            this.global = global;
            Prototype = global.ObjectClass.New();
            // Add the named parameters
            for (int i = 0; i < Math.Max(arguments.Length, callee.Arguments.Count); i++)
            {
                ValueDescriptor d = new ValueDescriptor(this, i < callee.Arguments.Count ? callee.Arguments[i] : i.ToString());

                d.Set(this, i < arguments.Length ? arguments[i] : JsUndefined.Instance);

                if (i < callee.Arguments.Count)
                    this.DefineOwnProperty(callee.Arguments[i], d);
                this.DefineOwnProperty(i.ToString(), d);
            }

            length = arguments.Length;
            calleeDescriptor = new ValueDescriptor(this, "callee");
            DefineOwnProperty("callee", calleeDescriptor);
            calleeDescriptor.Set(this, callee);
            DefineOwnProperty("length", new PropertyDescriptor<JsArguments>(global, this, "length", GetLength));
			DefineOwnProperty("array", new PropertyDescriptor<JsArguments>(global, this, "array", GetArray));
        }
コード例 #14
0
        public override void InitPrototype(IGlobal global)
        {
            Prototype = new JsObject() { Prototype = global.FunctionClass.Prototype };
            Prototype.DefineOwnProperty("constructor", this, PropertyAttributes.DontEnum);

            #region Methods
            Prototype.DefineOwnProperty("toString", global.FunctionClass.New<JsArray>(ToStringImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("toLocaleString", global.FunctionClass.New<JsArray>(ToLocaleStringImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("concat", global.FunctionClass.New<JsObject>(Concat), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("join", global.FunctionClass.New<JsObject>(Join, 1), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("pop", global.FunctionClass.New<JsObject>(Pop), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("push", global.FunctionClass.New<JsObject>(Push, 1), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("reverse", global.FunctionClass.New<JsObject>(Reverse), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("shift", global.FunctionClass.New<JsObject>(Shift), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("slice", global.FunctionClass.New<JsObject>(Slice, 2), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("sort", global.FunctionClass.New<JsObject>(Sort), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("splice", global.FunctionClass.New<JsObject>(Splice, 2), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("unshift", global.FunctionClass.New<JsObject>(UnShift, 1), PropertyAttributes.DontEnum);

            #region ES5
            Prototype.DefineOwnProperty("indexOf", global.FunctionClass.New<JsObject>(IndexOfImpl, 1), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("lastIndexOf", global.FunctionClass.New<JsObject>(LastIndexOfImpl, 1), PropertyAttributes.DontEnum);
            #endregion

            #endregion
        }
コード例 #15
0
ファイル: Kernel.cs プロジェクト: Sugz/SugzTools
 static Kernel()
 {
     // If this is ever NULL, it is probably because 3ds Max has not yet loaded 
     // Autodesk.Max.Wrappers.dll
     Global = GlobalInterface.Instance;
     Interface = Global.COREInterface16;
 }
コード例 #16
0
        public override void InitPrototype(IGlobal global)
        {
            //Prototype = global.FunctionClass;
            Prototype.DefineOwnProperty("constructor", this, PropertyAttributes.DontEnum);

            Prototype.DefineOwnProperty("UTC", new JsFunctionWrapper(UTCImpl), PropertyAttributes.DontEnum);

            #region Static Methods
            Prototype.DefineOwnProperty("now", new ClrFunction(new Func<JsDate>(() => { return Global.DateClass.New(DateTime.Now); })), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("parse", new JsFunctionWrapper(ParseImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("parseLocale", new JsFunctionWrapper(ParseLocaleImpl), PropertyAttributes.DontEnum);
            #endregion

            #region Methods
            Prototype.DefineOwnProperty("toString", global.FunctionClass.New<JsDictionaryObject>(ToStringImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("toDateString", global.FunctionClass.New<JsDictionaryObject>(ToDateStringImpl, 0), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("toTimeString", global.FunctionClass.New<JsDictionaryObject>(ToTimeStringImpl, 0), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("toLocaleString", global.FunctionClass.New<JsDictionaryObject>(ToLocaleStringImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("toLocaleDateString", global.FunctionClass.New<JsDictionaryObject>(ToLocaleDateStringImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("toLocaleTimeString", global.FunctionClass.New<JsDictionaryObject>(ToLocaleTimeStringImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("valueOf", global.FunctionClass.New<JsDictionaryObject>(ValueOfImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("getTime", global.FunctionClass.New<JsDictionaryObject>(GetTimeImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("getFullYear", global.FunctionClass.New<JsDictionaryObject>(GetFullYearImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("getUTCFullYear", global.FunctionClass.New<JsDictionaryObject>(GetUTCFullYearImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("getMonth", global.FunctionClass.New<JsDictionaryObject>(GetMonthImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("getUTCMonth", global.FunctionClass.New<JsDictionaryObject>(GetUTCMonthImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("getDate", global.FunctionClass.New<JsDictionaryObject>(GetDateImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("getUTCDate", global.FunctionClass.New<JsDictionaryObject>(GetUTCDateImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("getDay", global.FunctionClass.New<JsDictionaryObject>(GetDayImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("getUTCDay", global.FunctionClass.New<JsDictionaryObject>(GetUTCDayImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("getHours", global.FunctionClass.New<JsDictionaryObject>(GetHoursImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("getUTCHours", global.FunctionClass.New<JsDictionaryObject>(GetUTCHoursImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("getMinutes", global.FunctionClass.New<JsDictionaryObject>(GetMinutesImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("getUTCMinutes", global.FunctionClass.New<JsDictionaryObject>(GetUTCMinutesImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("getSeconds", global.FunctionClass.New<JsDictionaryObject>(GetSecondsImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("getUTCSeconds", global.FunctionClass.New<JsDictionaryObject>(GetUTCSecondsImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("getMilliseconds", global.FunctionClass.New<JsDictionaryObject>(GetMillisecondsImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("getUTCMilliseconds", global.FunctionClass.New<JsDictionaryObject>(GetUTCMillisecondsImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("getTimezoneOffset", global.FunctionClass.New<JsDictionaryObject>(GetTimezoneOffsetImpl), PropertyAttributes.DontEnum);

            Prototype.DefineOwnProperty("setTime", global.FunctionClass.New<JsDictionaryObject>(SetTimeImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("setMilliseconds", global.FunctionClass.New<JsDictionaryObject>(SetMillisecondsImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("setUTCMilliseconds", global.FunctionClass.New<JsDictionaryObject>(SetUTCMillisecondsImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("setSeconds", global.FunctionClass.New<JsDictionaryObject>(SetSecondsImpl, 2), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("setUTCSeconds", global.FunctionClass.New<JsDictionaryObject>(SetUTCSecondsImpl, 2), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("setMinutes", global.FunctionClass.New<JsDictionaryObject>(SetMinutesImpl, 3), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("setUTCMinutes", global.FunctionClass.New<JsDictionaryObject>(SetUTCMinutesImpl, 3), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("setHours", global.FunctionClass.New<JsDictionaryObject>(SetHoursImpl, 4), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("setUTCHours", global.FunctionClass.New<JsDictionaryObject>(SetUTCHoursImpl, 4), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("setDate", global.FunctionClass.New<JsDictionaryObject>(SetDateImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("setUTCDate", global.FunctionClass.New<JsDictionaryObject>(SetUTCDateImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("setMonth", global.FunctionClass.New<JsDictionaryObject>(SetMonthImpl, 2), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("setUTCMonth", global.FunctionClass.New<JsDictionaryObject>(SetUTCMonthImpl, 2), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("setFullYear", global.FunctionClass.New<JsDictionaryObject>(SetFullYearImpl, 3), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("setUTCFullYear", global.FunctionClass.New<JsDictionaryObject>(SetUTCFullYearImpl, 3), PropertyAttributes.DontEnum);

            Prototype.DefineOwnProperty("toUTCString", global.FunctionClass.New<JsDictionaryObject>(ToUTCStringImpl), PropertyAttributes.DontEnum);
            #endregion
        }
コード例 #17
0
ファイル: OutlinerUpdater.cs プロジェクト: Sugz/Outliner-3.0
      public static void Stop()
      {
         if (global != null && ProcColorChanged != null)
            global.UnRegisterNotification(ProcColorChanged, null, ColorTags.TagChanged);

         global = null;
         ProcColorChanged = null;
      }
コード例 #18
0
        public override void InitPrototype(IGlobal global) {
            //Prototype = global.FunctionClass;
            var Prototype = PrototypeProperty;

            Prototype.DefineOwnProperty("name", global.StringClass.New(errorType), PropertyAttributes.DontEnum | PropertyAttributes.DontDelete | PropertyAttributes.ReadOnly);
            Prototype.DefineOwnProperty("toString", global.FunctionClass.New<JsDictionaryObject>(ToStringImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("toLocaleString", global.FunctionClass.New<JsDictionaryObject>(ToStringImpl), PropertyAttributes.DontEnum);
        }
コード例 #19
0
ファイル: JsClr.cs プロジェクト: pusp/o2platform
        public JsClr(IJintVisitor visitor)
        {
            this.global = visitor.Global;
            this.propertyGetter = visitor.PropertyGetter;
            this.methodGetter = visitor.MethodGetter;
            this.fieldGetter = visitor.FieldGetter;
            value = null;

        }
コード例 #20
0
        public override void InitPrototype(IGlobal global) {
            var Prototype = PrototypeProperty;

            Prototype.DefineOwnProperty("toString", global.FunctionClass.New<JsInstance>(ToStringImpl,1), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("toLocaleString", global.FunctionClass.New<JsInstance>(ToLocaleStringImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("toFixed", global.FunctionClass.New<JsInstance>(ToFixedImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("toExponential", global.FunctionClass.New<JsInstance>(ToExponentialImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("toPrecision", global.FunctionClass.New<JsInstance>(ToPrecisionImpl), PropertyAttributes.DontEnum);
        }
コード例 #21
0
ファイル: JsClr.cs プロジェクト: Fedorm/core-master
        public JsClr(IJintVisitor visitor)
        {
            _global = visitor.Global;
            _propertyGetter = visitor.PropertyGetter;
            _fieldGetter = visitor.FieldGetter;
            _entityAccessor = visitor.EntityAccessor;

            value = null;
        }
コード例 #22
0
        public override void InitPrototype(IGlobal global)
        {
            Prototype = new JsObject() { Prototype = global.FunctionClass.Prototype };

            Prototype.DefineOwnProperty("constructor", this, PropertyAttributes.DontEnum);

            Prototype.DefineOwnProperty("toString", global.FunctionClass.New<JsDictionaryObject>(ToString2), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("toLocaleString", global.FunctionClass.New<JsDictionaryObject>(ToString2), PropertyAttributes.DontEnum);
        }
コード例 #23
0
ファイル: Kernel.cs プロジェクト: Sugz/ReleaseMaxSharp2013
 static Kernel()
 {
     // If this is ever NULL, it is probably because 3ds Max has not yet loaded 
     // Autodesk.Max.Wrappers.dll
     _Global = Autodesk.Max.GlobalInterface.Instance;
     _Interface = _Global.COREInterface13;
     scene = new Scene(_Interface);
     dispatcher = Dispatcher.CurrentDispatcher;
 }
コード例 #24
0
        public JsBooleanConstructor(IGlobal global)
            : base(global) {
            Name = "Boolean";

            DefineOwnProperty(PROTOTYPE, global.ObjectClass.New(this), PropertyAttributes.DontEnum | PropertyAttributes.DontDelete | PropertyAttributes.ReadOnly);

            True = New(true);
            False = New(false);
        }
コード例 #25
0
        public override void InitPrototype(IGlobal global) {
            var Prototype = PrototypeProperty;
            //Prototype = global.ObjectClass.New(this);

            Prototype.DefineOwnProperty("toString", global.FunctionClass.New<JsDictionaryObject>(ToStringImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("toLocaleString", global.FunctionClass.New<JsDictionaryObject>(ToStringImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("lastIndex", global.FunctionClass.New<JsRegExp>(GetLastIndex), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("exec", global.FunctionClass.New<JsRegExp>(ExecImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("test", global.FunctionClass.New<JsRegExp>(TestImpl), PropertyAttributes.DontEnum);
        }
コード例 #26
0
ファイル: JsDateConstructor.cs プロジェクト: 925coder/ravendb
        protected JsDateConstructor(IGlobal global, bool initializeUTC)
            : base(global) {
            Name = "Date";
            DefineOwnProperty(PROTOTYPE, global.ObjectClass.New(this), PropertyAttributes.DontEnum | PropertyAttributes.DontDelete | PropertyAttributes.ReadOnly);

            DefineOwnProperty("now", new ClrFunction(new Func<JsDate>(() => { return Global.DateClass.New(DateTime.Now); }), global.FunctionClass.PrototypeProperty), PropertyAttributes.DontEnum);
            DefineOwnProperty("parse", new JsFunctionWrapper(ParseImpl, global.FunctionClass.PrototypeProperty), PropertyAttributes.DontEnum);
            DefineOwnProperty("parseLocale", new JsFunctionWrapper(ParseLocaleImpl, global.FunctionClass.PrototypeProperty), PropertyAttributes.DontEnum);
            DefineOwnProperty("UTC", new JsFunctionWrapper(UTCImpl, global.FunctionClass.PrototypeProperty), PropertyAttributes.DontEnum);
        }
コード例 #27
0
        public JsNumberConstructor(IGlobal global)
            : base(global)
        {
            Name = "Number";

            this.DefineOwnProperty("MAX_VALUE", New(Double.MaxValue));
            this.DefineOwnProperty("MIN_VALUE", New(Double.MinValue));
            this.DefineOwnProperty("NaN", New(Double.NaN));
            this.DefineOwnProperty("NEGATIVE_INFINITY", New(Double.PositiveInfinity));
            this.DefineOwnProperty("POSITIVE_INFINITY", New(Double.NegativeInfinity));
        }
コード例 #28
0
        public override void InitPrototype(IGlobal global)
        {
            //Prototype = new JsPrototype(global.FunctionClass.Prototype);
            Prototype.DefineOwnProperty("constructor", this, PropertyAttributes.DontEnum);

            Prototype.DefineOwnProperty("toString", global.FunctionClass.New<JsInstance>(ToStringImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("toLocaleString", global.FunctionClass.New<JsNumber>(ToLocaleStringImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("toFixed", global.FunctionClass.New<JsNumber>(ToFixedImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("toExponential", global.FunctionClass.New<JsNumber>(ToExponentialImpl), PropertyAttributes.DontEnum);
            Prototype.DefineOwnProperty("toPrecision", global.FunctionClass.New<JsNumber>(ToPrecisionImpl), PropertyAttributes.DontEnum);
        }
コード例 #29
0
        public JsNumberConstructor(IGlobal global)
            : base(global) {
            Name = "Number";

            DefineOwnProperty(PROTOTYPE, global.ObjectClass.New(this), PropertyAttributes.ReadOnly | PropertyAttributes.DontEnum | PropertyAttributes.DontDelete);

            this.DefineOwnProperty("MAX_VALUE", New(Double.MaxValue));
            this.DefineOwnProperty("MIN_VALUE", New(Double.MinValue));
            this.DefineOwnProperty("NaN", New(Double.NaN));
            this.DefineOwnProperty("NEGATIVE_INFINITY", New(Double.PositiveInfinity));
            this.DefineOwnProperty("POSITIVE_INFINITY", New(Double.NegativeInfinity));
        }
コード例 #30
0
        public MaxBridgeUtility()
        {
            Global = Autodesk.Max.GlobalInterface.Instance;
            Log.MaxLogger = Global.COREInterface.Log;
            Log.LogLevel = LogLevel.All;
            Log.EnableLog = true;
            Log.Add("Starting DazMaxBridge.", LogLevel.Information);

            Plugin = new MaxPlugin(Global);

            Log.Add("Starting UI.", LogLevel.Debug);

            GUI = new UtilityMainForm(this);
        }
コード例 #31
0
        /// <summary>
        /// guarda la tabla de contadores por tipos
        /// </summary>
        /// <param name="codtido">Codigo Tipo</param>
        /// <param name="datos">DataTable de con los contadores</param>
        public void GuardarTablaContadores(string codtido, ref DataTable datos)
        {
            string sql = "select * from CNTD_CONTADOR_TIDO where cod_tido='" + codtido + "'";

            IGlobal.guardar_datos(sql, ref datos);
        }
コード例 #32
0
 public JsStringConstructor(IGlobal global)
     : base(global)
 {
     DefineOwnProperty(PROTOTYPE, global.ObjectClass.New(this), PropertyAttributes.ReadOnly | PropertyAttributes.DontDelete | PropertyAttributes.DontEnum);
     Name = "String";
 }
コード例 #33
0
 public JsFunctionConstructor(IGlobal global, JsObject prototype)
     : base(global, prototype)
 {
     Name = "Function";
     DefineOwnProperty(PROTOTYPE, prototype, PropertyAttributes.DontEnum | PropertyAttributes.DontDelete | PropertyAttributes.ReadOnly);
 }
コード例 #34
0
ファイル: Productos.cs プロジェクト: lvalerab/tpv
 public void Guardar(ref MySqlConnection cn, ref MySqlTransaction tr)
 {
     this.RellenarIdsNuevos(ref cn, ref tr);
     IGlobal.guardar_datos(_SQL, ref this._datos, ref cn, ref tr);
 }
コード例 #35
0
 public WalkingCharacterClassDesc(IGlobal global)
 {
     this.global = global;
     WalkingCharacterClassID = global.Class_ID.Create(0x5cd75bd2, 0xc497dd9);
 }
コード例 #36
0
 public JsError(IGlobal global, string message)
 {
     this.global  = global;
     this.message = message;
 }
コード例 #37
0
        private void m_btnExplodeIt_Click(object sender, RoutedEventArgs e)
        {
            //
            IGlobal      global = Autodesk.Max.GlobalInterface.Instance;
            IInterface14 ip     = global.COREInterface14;

            this.m_pnlProgressPanel.Visibility = System.Windows.Visibility.Visible;

            try
            {
                global.TheHold.Begin();

                ADN_Utility.SetProgressControl(this);

                bool convertPoly = EI_ConvertTypePoly; // true = poly, false = tri
                bool attemptConvert;
                if (convertPoly)
                {
                    attemptConvert = EI_AttemptConvertToPoly;
                }
                else
                {
                    attemptConvert = EI_AttemptConvertToTri;
                }
                bool  addShell      = EI_AddShellModifier;
                float shellAmount   = EI_ShellAmount;
                bool  addEditMesh   = EI_AddEditMeshModifier;
                bool  collapseStack = EI_CollapseStack;
                bool  deleteNode    = EI_DeleteOriginal;

                //ip.DisableSceneRedraw();
                int stat         = 0;
                int nNumSelNodes = ip.SelNodeCount;
                m_lblTotNode.Content = nNumSelNodes.ToString();

                for (int i = 0; i < nNumSelNodes; i++)
                {
                    IINode nodeCur = ip.GetSelNode(i);
                    m_lblNodeName.Content = nodeCur.Name;
                    m_lblCurrNode.Content = i + 1;
                    if (convertPoly)
                    {
                        stat = ADN_Utility.ConvertToPolygonFaces(nodeCur.Handle, attemptConvert, addShell, shellAmount, addEditMesh, collapseStack);
                        if (stat < 0)
                        {
                            break;
                        }
                    }
                    else
                    {
                        stat = ADN_Utility.ConvertToTriangleFaces(nodeCur.Handle, attemptConvert, addShell, shellAmount, addEditMesh, collapseStack);
                        if (stat < 0)
                        {
                            break;
                        }
                    }
                }


                if (stat < 0)
                {
                    global.TheHold.Cancel();
                }
                else
                {
                    // now we need to start at the top to delete the original nodes.
                    if (deleteNode)
                    {
                        IINodeTab tabNodes = global.INodeTab.Create();
                        ip.GetSelNodeTab(tabNodes);
                        if (tabNodes != null)
                        {
                            ip.DeleteNodes(tabNodes, true, true, false);
                        }
                    }
                    global.TheHold.Accept("ADN-PolygonExplode");
                }

                ip.RedrawViews(0, RedrawFlags.Normal, null);
            }
            catch
            {
                global.TheHold.Cancel();
            }

            this.m_pnlProgressPanel.Visibility = System.Windows.Visibility.Hidden;
            ADN_Utility.ClearProgressControl(this);

            m_winParent.Close();
            m_bOk = true;
        }
コード例 #38
0
 public JsStringConstructor(IGlobal global)
     : base(global)
 {
     Name = "String";
 }
コード例 #39
0
 public JsBooleanConstructor(IGlobal global)
     : base(global)
 {
     Name = "Boolean";
 }
コード例 #40
0
 public PropertyDescriptor(IGlobal global, JsDictionaryObject owner, string name)
     : base(owner, name)
 {
     this.global = global;
     Enumerable  = false;
 }
 public WalkingCharacterUtility(IGlobal global)
 {
     this.global = global;
 }
コード例 #42
0
 public MeshStruct(IGlobal global)
 {
     TriMesh  = global.Mesh.Create();
     PolyMesh = global.MNMesh.Create();
 }
コード例 #43
0
ファイル: NativeMethod.cs プロジェクト: lorinbeer/Jint.Phone
 public override JsInstance ToPrimitive(IGlobal global)
 {
     return(global.StringClass.New(ToString()));
 }
コード例 #44
0
 public JsObjectConstructor(IGlobal global, JsObject prototype, JsObject rootPrototype)
     : base(global)
 {
     Name = "Object";
     DefineOwnProperty(PROTOTYPE, rootPrototype, PropertyAttributes.DontEnum | PropertyAttributes.DontDelete | PropertyAttributes.ReadOnly);
 }
コード例 #45
0
 public JsError(IGlobal global, string message)
     : base(global.ErrorClass.PrototypeProperty)
 {
     this.global  = global;
     this.message = message;
 }
コード例 #46
0
 public static void Plot(IGlobal global, IList <INode> nodes, TrackingData data, IDataModifierContainer modifiers)
 {
 }
コード例 #47
0
 public JsErrorConstructor(IGlobal global, string errorType)
     : base(global)
 {
     this.errorType = errorType;
     Name           = errorType;
 }
コード例 #48
0
 public JsDateConstructor(IGlobal global)
     : this(global, true)
 {
 }
コード例 #49
0
 public JsError(IGlobal global)
     : this(global, string.Empty)
 {
 }
コード例 #50
0
 public JsArrayConstructor(IGlobal global)
     : base(global)
 {
     Name = "Array";
     DefineOwnProperty(PROTOTYPE, global.ObjectClass.New(this), PropertyAttributes.DontDelete | PropertyAttributes.DontEnum | PropertyAttributes.ReadOnly);
 }
コード例 #51
0
 // Those methods can be empty.
 // You just need the plugin interface to load dependant assemblies correctly
 public void Initialize(IGlobal global, ISynchronizeInvoke sync)
 {
     AppDomain.CurrentDomain.UnhandledException += AssemblyFunctions.CurrentDomain_UnhandledException;
 }
コード例 #52
0
        static void Main(string[] args)
        {
            Console.WriteLine("Starting...");
            Console.WriteLine("Read Settings...");

            var content  = File.ReadAllText("settings.json");
            var settings = JsonConvert.DeserializeObject <Settings>(content);

            Session session = null;
            IDoc    app     = null;

            try
            {
                var config = new EnigmaConfigurations()
                {
                    Url          = settings.ServerUri.AbsoluteUri,
                    CreateSocket = async(url) =>
                    {
                        var ws = new ClientWebSocket();
                        await ws.ConnectAsync(new Uri(url), CancellationToken.None);

                        return(ws);
                    }
                };

                session = Enigma.Create(config);
                var globalTask = session.OpenAsync();
                globalTask.Wait();
                IGlobal global  = Impromptu.ActLike <IGlobal>(globalTask.Result);
                var     appName = settings.App;
                Console.WriteLine($"Connect to App {appName}...");
                app = global.OpenDocAsync(appName).Result;

                Console.WriteLine($"Create Connections...");
                foreach (var qconn in settings.Connections)
                {
                    try
                    {
                        var connConfig = new Connection()
                        {
                            qType             = qconn.Type,
                            qName             = qconn.Name,
                            qConnectionString = qconn.ConnectionString
                        };
                        Console.WriteLine($"Create connection...");
                        var test = app.CreateConnectionAsync(connConfig).Result;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine($"No Connection created: {ex.ToString()}");
                    }
                }

                foreach (var scriptPath in settings.Scripts)
                {
                    var scriptContent = File.ReadAllText(scriptPath);
                    Console.WriteLine($"Reload Script...");
                    app.SetScriptAsync(scriptContent).Wait();
                    app.DoReloadAsync().Wait();
                }

                Console.WriteLine($"Finish.");
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error:\n{ex.ToString()}");
                Console.ReadLine();
            }
        }
コード例 #53
0
ファイル: Marshal.cs プロジェクト: wagnerlouzada/jint
 /// <summary>
 /// Constaructs a new marshaller object.
 /// </summary>
 /// <param name="global">A global object which can be used for constructing new JsObjects while marshalling.</param>
 public Marshaller(IGlobal global)
 {
     this.m_global = global;
 }
コード例 #54
0
 public static void AssemblyMain()
 {
     Global = Autodesk.Max.GlobalInterface.Instance;
     Core   = Global.COREInterface14;
     Core.AddClass(new Descriptor());
 }
コード例 #55
0
 public JsRegExpConstructor(IGlobal global)
     : base(global)
 {
     this.Name = "RegExp";
     this.DefineOwnProperty(JsFunction.PROTOTYPE, (JsInstance)global.ObjectClass.New((JsFunction)this), PropertyAttributes.ReadOnly | PropertyAttributes.DontEnum | PropertyAttributes.DontDelete);
 }
コード例 #56
0
 public void guardar()
 {
     IGlobal.guardar_datos(_SQL, ref this._datos);
 }
コード例 #57
0
 public ClrPropertyDescriptor(IPropertyGetter getter, IGlobal global, JsDictionaryObject owner, string propertyName)
     : base(owner, propertyName)
 {
     this.global = global;
     this.getter = getter;
 }
コード例 #58
0
 public bool PerformAction(IGlobal global, ActionParameters parameter)
 {
     if (!this.Abilities.Check(parameter.action))
     {
         Debug.WriteLine("Failed: Entity does not have ability to Receive");
         return(false);
     }
     else
     {
         bool success = false;
         // retrieve the item
         if (parameter.action == GeneralAbilities.Receive)
         {
             var item = global.World.GetItem(parameter.itemID);
             if (item != null)
             {
                 success = (this.Inventory.Set(item, (InventorySlot)parameter.targetIndex, this.Stats) || this.Inventory.Set(item, (InventorySlot)(-1), this.Stats));
             }
         }
         else if (parameter.action == GeneralAbilities.Destroy)
         {
             var item = this.Inventory.Get((InventorySlot)parameter.targetIndex, this.Stats);
             if (item != null)
             {
                 if (parameter.targetQuantity <= item.Count)
                 {
                     item.Count -= (int)parameter.targetQuantity;
                     if (item.Count != 0)
                     {
                         this.Inventory.Set(item, (InventorySlot)parameter.targetIndex, this.Stats);
                     }
                     success = true;
                 }
             }
         }
         else if (parameter.action == GeneralAbilities.Give)
         {
             var item = this.Inventory.Get((InventorySlot)parameter.targetIndex, this.Stats);
             if (item != null)
             {
                 success = true;
             }
         }
         else if (parameter.action == GeneralAbilities.DistributeSkillPoints)
         {
             success = this.Skills.DistributePoints((StatType)parameter.targetIndex, this.Stats, parameter.targetQuantity);
         }
         else if (parameter.action == GeneralAbilities.MoveInventory)
         {
             //this.Position = parameter.position;
             success = this.Inventory.Swap((InventorySlot)parameter.targetIndex, (InventorySlot)parameter.targetIndex2, this.Stats);
         }
         else if (parameter.action == GeneralAbilities.TakeDamage)
         {
             success = this.AdjustHealth(parameter.targetQuantity);
         }
         else if (parameter.action == GeneralAbilities.GiveDamage)
         {
             success = true; // do nothing? not sure
         }
         else if (parameter.action == GeneralAbilities.Use)
         {
             IItem item = this.Inventory.Get((InventorySlot)parameter.targetIndex, this.Stats);
             // somehow an item is used
             if (item != null)
             {
                 success = true; // for now
             }
         }
         if (!success)
         {
             Debug.WriteLine("Failed to perform action {0}", parameter.action);
         }
         return(success);
     }
 }
コード例 #59
0
 public CameraTrackerUI(IGlobal global)
 {
     m_global = global;
     InitializeComponent();
 }
コード例 #60
0
 public static void SetGlobal(IGlobal global)
 {
     m_Global = global;
 }