Esempio n. 1
0
        void Setup()
        {
            Instance   = this;
            GameObject = new GameObject();

            Areas    = new AreaManager();
            Factions = new FactionManager();
            Hud      = new HudManager();
            Pins     = new PinManager();
            Users    = new UserManager();
            Wars     = new WarManager();
            Zones    = new ZoneManager();

            Factions.Init(TryLoad <FactionInfo>(FactionsFile));
            Areas.Init(TryLoad <AreaInfo>(AreasFile));
            Pins.Init(TryLoad <PinInfo>(PinsFile));
            Users.Init();
            Wars.Init(TryLoad <WarInfo>(WarsFile));
            Zones.Init();
            Hud.Init();

            Hud.GenerateMapOverlayImage();

            if (Options.Upkeep.Enabled)
            {
                UpkeepCollectionTimer = timer.Every(Options.Upkeep.CheckIntervalMinutes * 60, Upkeep.CollectForAllFactions);
            }

            PrintToChat($"{Title} v{Version} initialized.");
            Ready = true;
        }
Esempio n. 2
0
    void Awake()
    {
        Instance = this;

        // sort by display priority
        pinConfig.pinList.Sort((x, y) => {
            // alphabetical within the same displayPriority
            if (x.displayPriority == y.displayPriority)
            {
                return(String.Compare(x.displayName, y.displayName));

                // by displayPriority
            }
            else
            {
                return(x.displayPriority - y.displayPriority);
            }
        });

        // populate the pin look up table.
        for (int i = 0; i < pinConfig.pinList.Count; ++i)
        {
            PINLOOKUP[pinConfig.pinList[i].Type] = pinConfig.pinList[i];
        }
    }
Esempio n. 3
0
    void Update()
    {
        time += Time.deltaTime;

        if (SceneManager.GetActiveScene().name != "GameplayBowling")
        {
            return;
        }

        if (!ballGameObject.GetComponent <Ball>().fallen)
        {
            return;
        }

        if (timeAtFall == 0)
        {
            timeAtFall = time;
        }

        if (!(time > timeAtFall + resetDelay))
        {
            return;
        }

        timeAtFall = 0;
        ballGameObject.GetComponent <Ball>().ResetBall();
        ballGameObject.GetComponent <Ball>().fallen = false;
        PinManager.Get().DestroyPins();
        CheckGameOver();
    }
Esempio n. 4
0
 // Use this for initialization
 void Start()
 {
     _ball        = GetComponent <Ball>();
     _xBound      = GameObject.Find("Floor").transform.lossyScale.x / 2 - _ball.transform.lossyScale.x / 2;
     _panelWidth  = Camera.main.ViewportToScreenPoint(transform.lossyScale).x;
     _pinSetter   = FindObjectOfType <PinManager>();
     _gameManager = FindObjectOfType <GameManager>();
 }
Esempio n. 5
0
        private void SetTemplate()
        {
            LayoutRoot.RenderTransform = new TranslateTransform();

            PM = new PinManager();
            UpdatePinData();

            InitAppBar();
        }
Esempio n. 6
0
 private void Awake()
 {
     if (instance != null)
     {
         Destroy(gameObject);
         return;
     }
     instance = this;
     DontDestroyOnLoad(gameObject);
 }
Esempio n. 7
0
    void Start()
    {
        pinMngr = GameObject.FindObjectOfType <PinManager> ();
        score   = GameObject.FindObjectOfType <Score> ();
        tball   = GameObject.FindObjectOfType <TestBall> ();


        score.green1.SetActive(true);
        score.green2.SetActive(false);
    }
Esempio n. 8
0
        public ActionResult Index(PinManager pinManager)
        {
            var _pinManager = db.PinManagers.FirstOrDefault(pin => pin.Pin.Equals(pinManager.Pin));

            if (_pinManager != null)
            {
                return(RedirectToAction("Create", "Users", new { pin = _pinManager.Pin }));
            }
            ModelState.AddModelError("Pin", "Pin is incorrect!");
            return(View(pinManager));
        }
Esempio n. 9
0
    void Start()
    {
        instance = this;
        pins     = new List <GameObject>(GameObject.FindGameObjectsWithTag("Pin"));

        if (SceneManager.GetActiveScene().name != "GameplayBowling")
        {
            return;
        }
        ball       = GameObject.FindGameObjectWithTag("Ball");
        ballScript = ball.GetComponent <Ball>();
    }
Esempio n. 10
0
    // Use this for initialization
    void Start()
    {
        pinSetter    = GameObject.FindObjectOfType <PinSetter>();
        actionMaster = GameObject.FindObjectOfType <ActionMasterOld>();
        ball         = GameObject.FindObjectOfType <BowlingBall>();
        pinManager   = GameObject.FindObjectOfType <PinManager>();
        scoreDisplay = GameObject.FindObjectOfType <ScoreDisplay>();
        pinList      = new List <int>();

        scoreDisplay.UpdateCumulativeScoreTexts(pinList);
        scoreDisplay.UpdateRollsTexts(pinList);
    }
Esempio n. 11
0
        private string RegisterUser(string id)
        {
            var pinManager = new PinManager
            {
                UserId = Convert.ToInt16(id),
                Pin    = new Random().Next(1000, 9999)
            };

            db.PinManagers.Add(pinManager);
            db.SaveChanges();
            Global.QrBytes = null;
            return(pinManager.Pin.ToString());
        }
Esempio n. 12
0
        private async void PinSpider(object sender, RoutedEventArgs e)
        {
            string TileId = await PageProcessor.PinToStart(ThisBook);

            if (!string.IsNullOrEmpty(TileId))
            {
                PinManager PM = new PinManager();
                PM.RegPin(ThisBook, TileId, true);

                SpiderBook SpDef = await SpiderBook.CreateSAsync(ThisBook.ZItemId);

                await PageProcessor.RegLiveSpider(SpDef, ( BookInstruction )ThisBook, TileId);
            }
        }
Esempio n. 13
0
    /// <summary>
    /// Called at start, creates event listeners so the pins can be moved
    /// </summary>
    void Start()
    {
        PinManager pM = GameObject.FindObjectOfType <PinManager>();

        EventTrigger trigger = gameObject.AddComponent <EventTrigger>();

        EventTrigger.Entry drag = new EventTrigger.Entry();
        drag.eventID = EventTriggerType.Drag;
        drag.callback.AddListener((data) => { pM.Drag(gameObject); });
        trigger.triggers.Add(drag);

        EventTrigger.Entry release = new EventTrigger.Entry();
        release.eventID = EventTriggerType.PointerUp;
        release.callback.AddListener((data) => { pM.Release(gameObject); });
        trigger.triggers.Add(release);
    }
Esempio n. 14
0
        private async void PinItemToStart(object sender, RoutedEventArgs e)
        {
            SpiderBook B = ( SpiderBook )(( FrameworkElement )sender).DataContext;

            if (B.ProcessSuccess)
            {
                BookInstruction Book   = B.GetBook();
                string          TileId = await PageProcessor.PinToStart(Book);

                if (!string.IsNullOrEmpty(TileId))
                {
                    PinManager PM = new PinManager();
                    PM.RegPin(Book, TileId, true);

                    await PageProcessor.RegLiveSpider(B, Book, TileId);
                }
            }
        }
Esempio n. 15
0
 public ActionResult Index(PinManager pinManager)
 {
     if (db.PinManagers.FirstOrDefault(reg => reg.Pin.Equals(pinManager.Pin)) != null)
     {
         var user = db.Users.Find(pinManager.UserId);
         if (user == null)
         {
             return(RedirectToAction("Create", "Users", new { pin = pinManager.Pin }));
         }
         else
         {
             return(RedirectToAction("ResetPassword", "Login", new { pin = pinManager.Pin }));
         }
     }
     else
     {
         ModelState.AddModelError("Pin", "Pin is incorrect!");
     }
     return(View(pinManager));
 }
Esempio n. 16
0
        private async Task Initialize()
        {
            _isActive = true;

            _manager = await PinManager.CreateAsync();

            _ledPin1             = _manager.CreatePin <IGpioOutputPin>(5);
            _ledPin2             = _manager.CreatePin <IGpioOutputPin>(25);
            _ledPin3             = _manager.CreatePin <IGpioOutputPin>(12);
            _button              = new SwitchButton(_manager.CreatePin <IGpioInputPin>(26, DriveMode.InputPullUp));
            _button.ActiveAction = () => { _isActive = !_isActive; };

            _display = new SingleDigitDisplayDevice(_manager.CreatePin <IGpioOutputPin>(17), _manager.CreatePin <IGpioOutputPin>(18), _manager.CreatePin <IGpioOutputPin>(27));

            _servo = new Servo(_manager.CreatePin <IPwmPin>(13));

            _servo.DesiredAngle = 0;

            await _manager.InitializeAsync();
        }
Esempio n. 17
0
        public ActionResult ForgotPassword(User user)
        {
            var u = db.Users.FirstOrDefault(s => s.Email.Equals(user.Email));

            if (u != null)
            {
                Random     generator = new Random();
                PinManager fg        = new PinManager();
                fg.UserId = Convert.ToInt16(u.Id);
                fg.Pin    = generator.Next(1000, 9999);
                db.PinManagers.Add(fg);
                db.SaveChanges();

                var link    = Url.Action("ResetPassword", "Login", new { pin = fg.Pin }, Request.Url.Scheme);
                var body    = "<p>To reset your password follow this link:</p><a href='" + link + "'>Reset password</a>";
                var message = new MailMessage();
                message.To.Add(new MailAddress(user.Email));
                message.From       = new MailAddress("*****@*****.**");
                message.Subject    = "Password recover";
                message.Body       = string.Format(body);
                message.IsBodyHtml = true;

                using (var smtp = new SmtpClient())
                {
                    var credential = new NetworkCredential
                    {
                        UserName = "******",
                        Password = "******"
                    };
                    smtp.Credentials    = credential;
                    smtp.Host           = "smtp.gmail.com";
                    smtp.Port           = 25;
                    smtp.EnableSsl      = true;
                    smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
                    smtp.Send(message);
                }
                return(RedirectToAction("ForgotPasswordConfirmation"));
            }
            ModelState.AddModelError("Email", "Email does not exist!");
            return(View(user));
        }
Esempio n. 18
0
        private async void PinToStart_Click(object sender, RoutedEventArgs e)
        {
            if ((( FrameworkElement )sender).DataContext is GRRow <BookDisplay> BkRow)
            {
                BookItem BkItem = ItemProcessor.GetBookItem(BkRow.Source.Entry);
                string   TileId = await PageProcessor.PinToStart(BkItem);

                if (!string.IsNullOrEmpty(TileId))
                {
                    PinManager PM = new PinManager();
                    PM.RegPin(BkItem, TileId, true);

                    if (BkItem is BookInstruction BInst)
                    {
                        SpiderBook SBook = await SpiderBook.CreateSAsync(BkItem.ZoneId, BkItem.ZItemId, null);

                        await PageProcessor.RegLiveSpider(SBook, BInst, TileId);
                    }
                }
            }
        }
    // Start is called before the first frame update
    IEnumerator Start()
    {
        person = Utils.LoadPrefs();
        var request = HttpRequest.Get("People");

        yield return(request.SendWebRequest());

        if (HttpRequest.Error(request))
        {
            Debug.LogError(request.error);
        }
        else
        {
            Person[] arr = JsonConvert.DeserializeObject <Person[]>(request.downloadHandler.text);
            foreach (var item in arr)
            {
                PinManager clone = Instantiate(pin);
                clone.SetPerson(item);
            }
        }
    }
Esempio n. 20
0
        private async void PinDevToStart(object sender, RoutedEventArgs e)
        {
            if (ActionBlocked)
            {
                return;
            }
            ActionBlocked = true;

            PinManager PM = new PinManager();

            PinRecord[] Records = CurrRecords.Where(x => x.DevId == SelectedRecord.DevId && 0 < x.TreeLevel).ToArray();

            if (5 < Records.Length)
            {
                bool            Canceled = true;
                StringResources stx      = StringResources.Load("Message");
                await Popups.ShowDialog(UIAliases.CreateDialog(
                                            string.Format(stx.Str("ConfirmMassPin"), Records.Length)
                                            , () => Canceled = false
                                            , stx.Str("Yes"), stx.Str("No")
                                            ));

                if (Canceled)
                {
                    ActionBlocked = false;
                    return;
                }
            }

            foreach (PinRecord Record in Records)
            {
                await PinRecord(Record);
            }

            PM.Save();
            UpdatePinData();
            ActionBlocked = false;
        }
Esempio n. 21
0
 static Program()
 {
     PinMgr = new PinManager();
 }
Esempio n. 22
0
        private async void CheckTiles()
        {
            PinErrored = false;
            PinManager PM = new PinManager();

            await PM.SyncSettings();

            if (PM.Policy == PinPolicy.DO_NOTHING)
            {
                return;
            }

            ActiveItem[] MissingPins = PM.GetLocalPins().Where(
                x => !Windows.UI.StartScreen.SecondaryTile.Exists(x.Payload)
                ).ToArray();

            if (0 < MissingPins.Length)
            {
                switch (PM.Policy)
                {
                case PinPolicy.ASK:
                    bool            RemoveRecord = true;
                    StringResources stx          = StringResources.Load("Message", "AppBar", "ContextMenu");
                    await Popups.ShowDialog(UIAliases.CreateDialog(
                                                string.Format(stx.Str("MissingPins"), MissingPins.Length)
                                                , () => RemoveRecord = false
                                                , stx.Text("PinToStart", "ContextMenu"), stx.Text("PinPolicy_RemoveMissing", "AppBar")
                                                ));

                    if (RemoveRecord)
                    {
                        goto case PinPolicy.REMOVE_MISSING;
                    }
                    goto case PinPolicy.PIN_MISSING;

                case PinPolicy.PIN_MISSING:
                    foreach (ActiveItem Item in MissingPins)
                    {
                        BookItem Book = await ItemProcessor.GetBookFromId(Item.Desc);

                        if (Book == null)
                        {
                            PinError();
                        }
                        else
                        {
                            TaskCompletionSource <string> TileId = new TaskCompletionSource <string>();

                            BookLoader Loader = new BookLoader(async(b) =>
                            {
                                TileId.SetResult(b == null ? null : await PageProcessor.PinToStart(b));
                            });

                            Loader.Load(Book, true);
                            await TileId.Task;
                        }
                    }
                    break;

                case PinPolicy.REMOVE_MISSING:
                    PM.RemovePin(MissingPins.Remap(x => x.Desc));
                    break;
                }
            }
        }
Esempio n. 23
0
 private void Start()
 {
     _ballSpawner = GetComponentInParent <BallSpawner> ();
     _pinManager  = FindObjectOfType <PinManager> ();
 }
        public StationViewModel()
        {
            Stations = new ObservableCollection<Station>();
            PinManager = new PinManager();
            PinMan = new Pin(EPinType.MAN);
            PinMan.IsSelected = true;

            stationCount = new Dictionary<int, int>();

            CurrentStation = new Station();
            DetailsStation = new Station();
            NearestStation = new Station();

            pivotPhotosHeader = _resourceLoader.GetString("AppPhotos");

        }
Esempio n. 25
0
 private void pin_click(object sender, RoutedEventArgs e)
 {
     PinManager.PinPage(_Page_Name);
 }