public ActionResult Index(string id)
        {
            List <Mechanical> _MechanicalError;
            string            user = this.HttpContext.Request.RequestContext.HttpContext.User.Identity.Name;

            if (id == null)
            {
                id = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") + "$";
            }

            string _MyTime = id.Substring(0, id.LastIndexOf("$"));

            _MechanicalError = MechanicalErrorController.Cache.MechanicalList.FindAll(t => t.REPORTTIME.Date.Equals(DateTime.Parse(_MyTime))).ToList();

            string data = "";

            if (id.Length != id.IndexOf("$") + 1)
            {
                data = id.Substring(id.IndexOf("$") + 1, id.Length - id.IndexOf("$") - 1);
            }



            if (!string.IsNullOrEmpty(data))
            {
                _MechanicalError = _MechanicalError.FindAll(t => t.MECHANICALNO.ToUpper().Contains(data.ToUpper())).OrderByDescending(t => t.REPORTTIME).ToList();
            }
            else
            {
                _MechanicalError = _MechanicalError.OrderByDescending(t => t.REPORTTIME).ToList();
            }



            string noData = "暂无数据";

            if (_MechanicalError == null || _MechanicalError.Count == 0)
            {
                Mechanical mechanicalError = new Mechanical();

                mechanicalError.MECHANICALNO = noData;

                _MechanicalError.Add(mechanicalError);
            }

            _MechanicalError[0].SEARCHKEY = data;
            _MechanicalError[0].MyDate    = _MyTime;

            foreach (MechanicalError item in MechanicalErrorController.Cache.MechanicalErrorList)
            {
                if (item.JobNo.Equals(user) && item.ISSEND.ToUpper().Trim().Equals("Y"))
                {
                    MechanicalError.UpdateMechanicalError(item.ID);
                }
            }

            MechanicalErrorController.Cache.RefreshCache();

            return(View(_MechanicalError.ToList()));
        }
Beispiel #2
0
        public void Initialize()
        {
            CustomLocalizationManager.ImportCSV("ag88/Mech.csv", ';');
            clanRef = Clan.Make();
            RegisterSubtypes();

            MakeCards();

            //foreach (var bundle in BundleManager.LoadedAssetBundles)
            //{
            //    API.Log(BepInEx.Logging.LogLevel.All, bundle.Value.GetAllAssetNames().Join());
            //}

            Mechanical.Make();
            SecondMech.Make();
            MakeArtifacts();
        }
Beispiel #3
0
        public bool CreateMechanical(MechanicalCreate model)
        {
            var entity =
                new Mechanical()
            {
                Address              = (string)model.Address,
                ElecService          = model.ElecService,
                ElecServiceCondition = model.ElecServiceCondition,
                ServicePanel         = model.ServicePanel,
                PanelCondition       = model.PanelCondition,
                Wiring          = model.Wiring,
                WiringCondition = model.WiringCondition,
                SwitchPlug      = model.SwitchPlug,
                GFCPlug         = model.GFCPlug,
                SmokeDetectors  = model.SmokeDetectors
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.Mechanicals.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }
Beispiel #4
0
        private Enemy SpawnEnemy(TravelForm.Selection type)
        {
            Random random = new Random();

            int choose;

            switch (type)
            {
            case TravelForm.Selection.Forest:
                choose = random.Next(11);
                if (choose == 0)
                {
                    return(Humanoid.Generate((_player.level + 5 > 10) ? 5 : _player.level));
                }
                else
                {
                    return(Beast.Generate((_player.level + 5 > 10) ? 5 : _player.level));
                }

            case TravelForm.Selection.Cave:
                choose = random.Next(11);
                if (choose == 0)
                {
                    return(Humanoid.Generate((_player.level + 5 > 20) ? 15 : (_player.level - 5 < 10) ? 15 : _player.level));
                }
                else
                {
                    return(Goblinoid.Generate((_player.level + 5 > 20) ? 15 : (_player.level - 5 < 10) ? 15 : _player.level));
                }

            case TravelForm.Selection.Ethereal:
                return(Ethereal.Generate((_player.level + 5 > 90) ? 85 : (_player.level - 5 < 70) ? 75 : _player.level));

            case TravelForm.Selection.Graveyard:
                choose = random.Next(11);
                if (choose == 0)
                {
                    return(Humanoid.Generate((_player.level + 5 > 40) ? 35 : (_player.level - 5 < 20) ? 25 : _player.level));
                }
                else
                {
                    return(Undead.Generate((_player.level + 5 > 40) ? 35 : (_player.level - 5 < 20) ? 25 : _player.level));
                }

            case TravelForm.Selection.Mountains:
                choose = random.Next(21);
                if (choose == 0)
                {
                    return(Humanoid.Generate((_player.level + 5 > 55) ? 50 : (_player.level - 5 < 40) ? 45 : _player.level));
                }
                else if (choose > 0 && choose < 15)
                {
                    return(Giant.Generate((_player.level + 5 > 55) ? 50 : (_player.level - 5 < 40) ? 45 : _player.level));
                }
                else
                {
                    return(Dragonkin.Generate((_player.level + 5 > 55) ? 50 : (_player.level - 5 < 40) ? 45 : _player.level));
                }

            case TravelForm.Selection.Ruins:
                choose = random.Next(11);
                if (choose == 0)
                {
                    return(Humanoid.Generate((_player.level + 5 > 70) ? 65 : (_player.level - 5 < 55) ? 60 : _player.level));
                }
                else
                {
                    return(Mechanical.Generate((_player.level + 5 > 70) ? 65 : (_player.level - 5 < 55) ? 60 : _player.level));
                }

            case TravelForm.Selection.Underworld:
                return(Demon.Generate((_player.level - 5 < 90) ? 95 : _player.level));
            }
            return(null);
        }
        public override void Draw(Graphics graphics)
        {
            base.Draw(graphics);

            if (IsEndTile != true)
            {
                return;
            }

            Point centerPoint = new Point(Bounds.X + Bounds.Width / 2, Bounds.Y + Bounds.Height / 2);

            Pen black = Pens.Black;

            switch (Program.puzzleType)
            {
            case Program.PuzzleType.Elec:
                graphics.DrawLine(black, centerPoint.X - 5, centerPoint.Y, centerPoint.X + 5, centerPoint.Y);

                if (Electrical.Equals(Elec.positive) == true)
                {
                    // +
                    graphics.DrawLine(black, centerPoint.X, centerPoint.Y - 5, centerPoint.X, centerPoint.Y + 5);
                }
                break;

            case Program.PuzzleType.Mech:
                if (Mechanical.Equals(Mech.jagged) == true)
                {
                    int totalSpikes = 4;
                    int spikeHeight = (Tile.size - 1) / totalSpikes;
                    int spikeWidth  = spikeHeight / 2;

                    int y = Bounds.Y;

                    for (int i = 0; i < totalSpikes; i++)
                    {
                        int x = Bounds.X + 2 + spikeHeight * i;

                        graphics.DrawLine(black, x, y, x + spikeWidth, y + spikeHeight);
                        graphics.DrawLine(black, x + spikeWidth, y + spikeHeight, x + spikeWidth * 2, y);
                    }
                }

                if (Mechanical.Equals(Mech.rounded) == true)
                {
                    int totalBumps   = 4;
                    int bumpRadius   = (Tile.size - 1) / (totalBumps * 2);
                    int bumpDiameter = 2 * bumpRadius;

                    int y = Bounds.Y - 2;

                    for (int i = 0; i < totalBumps; i++)
                    {
                        int x = Bounds.X + 2 + bumpDiameter * i + i;

                        Rectangle circle = new Rectangle(x, y, bumpDiameter, bumpDiameter);
                        graphics.DrawArc(black, circle, 0, 180);
                    }
                }

                if (Mechanical.Equals(Mech.square) == true)
                {
                    int totalMerlons = 3;
                    int merlonWidth  = (Tile.size - 1) / (totalMerlons * 2 + 1);
                    int merlonHeight = merlonWidth + 2;

                    for (int i = 0; i < totalMerlons; i++)
                    {
                        int x = Bounds.X + 2 + merlonWidth + merlonWidth * i * 2;
                        int y = Bounds.Y;
                        graphics.DrawLine(black, x, y, x, y + merlonHeight);
                        graphics.DrawLine(black, x, y + merlonHeight, x + merlonWidth, y + merlonHeight);
                        graphics.DrawLine(black, x + merlonWidth, y + merlonHeight, x + merlonWidth, y);
                    }
                }
                break;

            case Program.PuzzleType.Plm:
                if (Plumbing.Equals(Plm.none) == true)
                {
                    break;
                }

                int margin = Tile.size / 4;

                // O
                Rectangle rect = new Rectangle(Bounds.X + margin, Bounds.Y + margin, Bounds.Width - 2 * margin, Bounds.Height - 2 * margin);
                graphics.DrawEllipse(black, rect);

                if (Plumbing.Equals(Plm.closed) == true)
                {
                    // Ø
                    graphics.DrawLine(black, rect.X, rect.Y, rect.X + rect.Width, rect.Y + rect.Height);
                }
                break;
            }
        }
Beispiel #6
0
 private static void InitCache()
 {
     MechanicalErrorList = MechanicalError.GetMechanicalErrors();
     MechanicalList      = Mechanical.GetMechanicals();
 }
Beispiel #7
0
    // Update is called once per frame
    void Update()
    {
        bool oxygenEnabled;
        bool powerEnabled;
        bool mechEnabled;

        RectTransform[] oxygenClicks     = null;
        RectTransform[] mechanicalClicks = null;
        RectTransform[] powerClicks      = null;

        try{
            oxygen        = GameObject.Find("OxygenSystem").GetComponent <Oxygen>();
            oxygenClicks  = oxygenObject [1].GetComponentsInChildren <RectTransform>();
            oxygenEnabled = true;
        }
        catch {
            oxygenEnabled = false;
        }
        try{
            mechanical       = GameObject.Find("MechnicalSystem").GetComponent <Mechanical>();
            mechanicalClicks = mechObject [1].GetComponentsInChildren <RectTransform>();
            mechEnabled      = true;
        }
        catch {
            mechEnabled = false;
        }

        try{
            power        = GameObject.Find("PowerSystem").GetComponent <Power>();
            powerClicks  = powerObject [1].GetComponentsInChildren <RectTransform>();
            powerEnabled = true;
        }
        catch {
            powerEnabled = false;
        }

        if (Input.touchCount != 0)
        {
            Touch      touch = Input.GetTouch(0);
            Ray        ray   = Camera.main.ScreenPointToRay(touch.position);
            var        pos   = Camera.main.ScreenToWorldPoint(touch.position);
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit) && touch.phase == TouchPhase.Began)
            {
                if (oxygenEnabled)
                {
                    for (int i = 1; i < oxygenClicks.Length; i += 2)
                    {
                        if (oxygen.getRoomEnable())
                        {
                            if (RectTransformUtility.RectangleContainsScreenPoint(oxygenClicks [i], pos))
                            {
//								print ("Touched Oxygen " + (i / 2));
                                if (oxygenSystem.GetComponent <Oxygen>().getRoomStatus(i / 2) == false)
                                {
                                    toolController.GetComponent <ToolController> ().makeWindow("Oxygen", i / 2);
                                }
                            }
                        }
                    }
                }
                if (mechEnabled)
                {
                    for (int i = 0; i < mechanicalClicks.Length; i++)
                    {
                        if (mechanical.getRoomEnable())
                        {
                            if (RectTransformUtility.RectangleContainsScreenPoint(mechanicalClicks [i], pos))
                            {
//								print ("Touched Door " + i);
                                if (mechanicalSystem.GetComponent <Mechanical> ().getRoomStatus(i) == false)
                                {
                                    toolController.GetComponent <ToolController> ().makeWindow("Mechanical", i);
                                }
                            }
                        }
                    }
                }
                if (powerEnabled)
                {
                    for (int i = 0; i < powerClicks.Length; i++)
                    {
                        if (power.getRoomEnable())
                        {
                            if (RectTransformUtility.RectangleContainsScreenPoint(powerClicks [i], pos))
                            {
//								print ("Touched " + powerClicks[i].name);
                                if (powerSystem.GetComponent <Power> ().getRoomStatus(i) == false)
                                {
                                    toolController.GetComponent <ToolController> ().makeWindow("Power", i);
                                }
                            }
                        }
                    }
                }
            }
        }

        if ((mechanical.getBrokenAmount() + oxygen.getBrokenAmount() + power.getBrokenAmount()) > brokenTotal)
        {
            updateHealthBar();
            brokenTotal = mechanical.getBrokenAmount() + oxygen.getBrokenAmount() + power.getBrokenAmount();
        }
    }