Пример #1
0
        private PyObject Load(byte[] data)
        {
            var s   = new PyString(data);
            var ret = LoadFunc.Call(s);

            return(ret);
        }
Пример #2
0
        internal DirectWindow(DirectEve directEve, PyObject pyWindow) : base(directEve)
        {
            PyWindow = pyWindow;

            Id         = (int?)pyWindow.Attribute("windowID");
            Type       = (string)pyWindow.Attribute("__guid__");
            Name       = (string)pyWindow.Attribute("name");
            IsKillable = (bool)pyWindow.Attribute("_killable");
            IsDialog   = (bool)pyWindow.Attribute("isDialog");
            IsModal    = (bool)pyWindow.Attribute("isModal");
            Caption    = (string)pyWindow.Call("GetCaption");

            var paragraphs = pyWindow.Attribute("edit").Attribute("sr").Attribute("paragraphs").ToList();
            var html       = paragraphs.Aggregate("", (current, paragraph) => current + (string)paragraph.Attribute("text"));

            if (String.IsNullOrEmpty(html))
            {
                html = (string)pyWindow.Attribute("edit").Attribute("sr").Attribute("currentTXT");
            }
            if (String.IsNullOrEmpty(html))
            {
                html = (string)pyWindow.Attribute("sr").Attribute("messageArea").Attribute("sr").Attribute("currentTXT");
            }

            Html = html;

            ViewMode = (string)pyWindow.Attribute("viewMode");
        }
Пример #3
0
        public bool ChangeAmmo(DirectItem charge)
        {
            if (charge.ItemId <= 0)
            {
                return(false);
            }

            if (charge.TypeId <= 0)
            {
                return(false);
            }

            if (charge.Stacksize <= 0)
            {
                return(false);
            }

            var realoadInfo = _pyModule.Call("GetChargeReloadInfo").ToList();

            if (charge.TypeId == (int)realoadInfo[0])
            {
                return(ReloadAmmo(charge));
            }
            else
            {
                _pyModule.Attribute("stateManager").Call("ChangeAmmoTypeForModule", ItemId, charge.TypeId);
                return(ReloadAmmo(charge));
            }
        }
Пример #4
0
        internal void GetDamageState()
        {
            _shieldPct    = 0;
            _armorPct     = 0;
            _structurePct = 0;

            // Get damage state properties
            var damageState = _ballpark.Call("GetDamageState", Id).ToList();

            if (damageState.Count == 3 ^ damageState.Count == 5)
            {
                _shieldPct    = (double)damageState[0];
                _armorPct     = (double)damageState[1];
                _structurePct = (double)damageState[2];
            }
        }
Пример #5
0
        internal DirectWindow(DirectEve directEve, PyObject pyWindow)
            : base(directEve)
        {
            PyWindow = pyWindow;

            Id = (int?) pyWindow.Attribute("windowID");
            Type = (string) pyWindow.Attribute("__guid__");
            Name = (string) pyWindow.Attribute("name");
            IsKillable = (bool) pyWindow.Attribute("_killable");
            IsDialog = (bool) pyWindow.Attribute("isDialog");
            IsModal = (bool) pyWindow.Attribute("isModal");
            Caption = (string) pyWindow.Call("GetCaption");

            var paragraphs = pyWindow.Attribute("edit").Attribute("sr").Attribute("paragraphs").ToList();
            var html = paragraphs.Aggregate("", (current, paragraph) => current + (string) paragraph.Attribute("text"));
            if (String.IsNullOrEmpty(html))
                html = (string) pyWindow.Attribute("edit").Attribute("sr").Attribute("currentTXT");
            if (String.IsNullOrEmpty(html))
                html = (string) pyWindow.Attribute("sr").Attribute("messageArea").Attribute("sr").Attribute("currentTXT");

            Html = html;

            ViewMode = (string) pyWindow.Attribute("viewMode");
        }
Пример #6
0
 public PyObject Forward(Variable <T> x)
 {
     return(_maxPooling2D.Call(x, _kSize, _stride, _pad));
 }
Пример #7
0
 public PyObject Forward(PyObject x)
 {
     return(_swish.Call(x));
 }
Пример #8
0
 public PyObject Forward(Variable <T> x)
 {
     return(_localResponseNormalization.Call(x, n, k, alpha, beta));
 }
Пример #9
0
 public PyObject Forward(PyObject x0, PyObject x1)
 {
     return(_softmaxCrossEntropy.Call(x0, x1));
 }
Пример #10
0
 public PyObject Forward(params PyObject[] x)
 {
     return(_concat.Call(PyTuple.Pack(x), axis));
 }
Пример #11
0
 public PyObject[] Forward(PyObject x, PyArray <int> indices, int axis = 1)
 {
     return(PyTuple.UnPack(_splitAxis.Call(x, indices, axis)));
 }
Пример #12
0
 public PyObject Forward(PyObject x0, PyObject x1)
 {
     return(_meanSquaredError.Call(x0, x1));
 }