private void Lockscreen_Touch(object sender, View.TouchEventArgs e)
 {
     using (ConfigurationManager configuration = new ConfigurationManager(PreferenceManager.GetDefaultSharedPreferences(Application.Context)))
     {
         if (configuration.RetrieveAValue(ConfigurationParameters.DoubleTapToSleep) == true)
         {
             if (e.Event.Action == MotionEventActions.Up)
             {
                 if (firstTouchTime == -1)
                 {
                     firstTouchTime = e.Event.DownTime;
                 }
                 else if (firstTouchTime != -1)
                 {
                     finalTouchTime = e.Event.DownTime;
                     if (firstTouchTime + threshold > finalTouchTime)
                     {
                         Awake.TurnOffScreen();
                     }
                     //Reset the values of touch
                     firstTouchTime = -1;
                     finalTouchTime = -1;
                 }
             }
         }
     }
 }
Пример #2
0
        /// <summary>
        /// Gets the preferred awakes from the listview.
        /// </summary>
        /// <returns></returns>
        public static List <Awake> GetPreferredAwakes(ListView lvi)
        {
            List <Awake> preferredAwakes = new List <Awake>();

            for (int i = 0; i < lvi.Items.Count; ++i)
            {
                Awake awake = new Awake();

                for (int j = 0; j < lvi.Items[i].SubItems.Count; ++j)
                {
                    string subitemValue = lvi.Items[i].SubItems[j].Text;

                    if (j == 0)
                    {
                        awake.TypeIndex = Convert.ToInt16(subitemValue);
                    }
                    else if (j == 1)
                    {
                        awake.Name = subitemValue;
                    }
                    else if (j == 2)
                    {
                        awake.Value = Convert.ToInt32(subitemValue);
                    }
                }

                preferredAwakes.Add(awake);
            }

            return(preferredAwakes);
        }
 private void CatcherHelper_NotificationPosted(object sender, NotificationPostedEventArgs e)
 {
     if (e.ShouldCauseWakeUp == true)
     {
         Awake.WakeUpScreen();
     }
 }
Пример #4
0
        private static List <Awake> ReadAwakeTypes(XmlNode settingsNode)
        {
            var awakeTypeNodes = XmlUtils.GetNode("AwakeTypes", settingsNode.ChildNodes);

            List <Awake> awakeTypes = new List <Awake>();

            foreach (XmlNode awakeTypeNode in awakeTypeNodes)
            {
                if (awakeTypeNode.Name == "Type")
                {
                    var comparisonAttr = XmlUtils.GetAttribute(awakeTypeNode, "comparisonmethod");

                    AwakeComparisonMethod comparisonMethod = AwakeComparisonMethod.Exact;

                    string substringToFind = "";

                    if (comparisonAttr != null)
                    {
                        if (comparisonAttr.Value == "Exact")
                        {
                            comparisonMethod = AwakeComparisonMethod.Exact;
                        }
                        else if (comparisonAttr.Value == "Contains")
                        {
                            comparisonMethod = AwakeComparisonMethod.Contains;
                            var textToFindAttr = XmlUtils.GetAttribute(awakeTypeNode, "text_to_find");

                            if (textToFindAttr == null)
                            {
                                throw new Exception("You are missing the text_to_find attribute in the awake because you have the Contains comparison method.");
                            }

                            substringToFind = textToFindAttr.Value;
                        }
                        else
                        {
                            throw new Exception("No valid awake comparison method");
                        }
                    }

                    var awake = new Awake()
                    {
                        Name             = XmlUtils.GetAttribute(awakeTypeNode, "name").Value,
                        Text             = XmlUtils.GetAttribute(awakeTypeNode, "gametext").Value,
                        SubstringToFind  = substringToFind,
                        TypeIndex        = (short)awakeTypes.Count,
                        ComparisonMethod = comparisonMethod,
                    };

                    awakeTypes.Add(awake);
                }
            }

            return(awakeTypes);
        }
        private void ButtonAddAwakeOnClick(object sender, EventArgs e)
        {
            int selectedComboIndex = ComboBoxAwakeType.SelectedIndex;

            if (selectedComboIndex == -1)
            {
                ErrorDisplayer.Error("You cannot add an awake without telling me which awaketype silly!");
                return;
            }

            int newAwakeValue = (int)NumericAwakeValue.Value;

            var newAwakeName = _serverConfig.AwakeTypes[selectedComboIndex].Name;

            int newAwakeGroup = (int)NumericAwakeGroup.Value;

            ListviewAwakes.Items.Add(new ListViewItem(new string[] {
                newAwakeName,
                newAwakeValue.ToString(),
                newAwakeGroup.ToString(),
            }));

            GroupBoxNewAwake.Visible = false;
            ResetAddAwakeControls();

            var newAwake = new Awake()
            {
                Name      = newAwakeName,
                Value     = newAwakeValue,
                TypeIndex = Convert.ToInt16(selectedComboIndex),
            };

            foreach (var preferredAwake in _preferredAwakeItems)
            {
                // Are they in the same group?
                if (newAwakeGroup == preferredAwake.Group)
                {
                    if (preferredAwake.Awake.TypeIndex == newAwake.TypeIndex)
                    {
                        ErrorDisplayer.Info("This type of awake is already added to the list.\n\n" +
                                            "When you add two different, they will interally be converted into one, the same goes for the awake on the item.\n\n" +
                                            "Example: If you add one STR+50 awake into the list, the bot will stop when it gets e.g. STR+23 and STR+30 because it will turn into STR+53 internally.");
                    }
                }
            }

            _preferredAwakeItems.Add(new AwakeItem
            {
                Awake = newAwake,
                Group = newAwakeGroup,
            });
        }
Пример #6
0
 //the order of the list is like the order of the fields in the object
 public static void updateTableByList(List <int> weightedSleepSegmentsStats)
 {
     if (weightedSleepSegmentsStats != null)
     {
         if (weightedSleepSegmentsStats.Count == (8 * 6))
         {
             Awake.updateSemgentByList(weightedSleepSegmentsStats, 0);
             Snooze.updateSemgentByList(weightedSleepSegmentsStats, 8 * 1);
             Doze.updateSemgentByList(weightedSleepSegmentsStats, 8 * 2);
             RestlessSleep.updateSemgentByList(weightedSleepSegmentsStats, 8 * 3);
             RestfulSleep.updateSemgentByList(weightedSleepSegmentsStats, 8 * 4);
             REMSleep.updateSemgentByList(weightedSleepSegmentsStats, 8 * 5);
         }
     }
 }
Пример #7
0
    //选择此觉醒牌
    public void SelectAwake(int select)
    {
        isAwakeSelect = select;
        myAwake       = S_awakes[select];

        //隐藏其他牌
        for (var i = 0; i < 3; i++)
        {
            awakePrefab[i].GetComponent <SelectHeroButton>().cardButton = HandCardButton.Cannot;
            if (i != select)
            {
                awakePrefab[i].transform.DOScale(Vector3.zero, 0.2f);
                Destroy(awakePrefab[i], 0.3f);
            }
        }

        Setout();
    }
Пример #8
0
        private static List <Awake> ReadAwakeTypes(XmlNode settingsNode)
        {
            var awakeTypeNodes = XmlUtils.GetNode("AwakeTypes", settingsNode.ChildNodes);

            List <Awake> awakeTypes = new List <Awake>();

            foreach (XmlNode awakeTypeNode in awakeTypeNodes)
            {
                if (awakeTypeNode.Name == "Type")
                {
                    var comparisonAttr = XmlUtils.GetAttribute(awakeTypeNode, "comparisonmethod");

                    AwakeComparisonMethod comparisonMethod = AwakeComparisonMethod.Exact;

                    if (comparisonAttr != null)
                    {
                        if (comparisonAttr.Value == "Exact")
                        {
                            comparisonMethod = AwakeComparisonMethod.Exact;
                        }
                        else if (comparisonAttr.Value == "Contains")
                        {
                            comparisonMethod = AwakeComparisonMethod.Contains;
                        }
                        else
                        {
                            throw new Exception("No valid awake comparison method");
                        }
                    }

                    var awake = new Awake()
                    {
                        Name             = XmlUtils.GetAttribute(awakeTypeNode, "name").Value,
                        Text             = XmlUtils.GetAttribute(awakeTypeNode, "gametext").Value,
                        TypeIndex        = (short)awakeTypes.Count,
                        ComparisonMethod = comparisonMethod,
                    };

                    awakeTypes.Add(awake);
                }
            }

            return(awakeTypes);
        }
Пример #9
0
        private void Main()
        {
            Awake?.Invoke(this, EventArgs.Empty);
            Start?.Invoke(this, EventArgs.Empty);

            ThreadMethodEntry methodEntry;

            while (!_disposed)
            {
                methodEntry = _entries.Take();

                if (!methodEntry.IsCompleted)
                {
                    BeforeInvoking?.Invoke(this, EventArgs.Empty);
                    methodEntry.Invoke();
                    AfterInvoking?.Invoke(this, EventArgs.Empty);
                }
            }
        }
Пример #10
0
    public UserItem(BinaryReader reader, int version = int.MaxValue, int Customversion = int.MaxValue)
    {
        UniqueID = reader.ReadUInt64();
        ItemIndex = reader.ReadInt32();

        CurrentDura = reader.ReadUInt16();
        MaxDura = reader.ReadUInt16();

        Count = reader.ReadUInt32();

        AC = reader.ReadByte();
        MAC = reader.ReadByte();
        DC = reader.ReadByte();
        MC = reader.ReadByte();
        SC = reader.ReadByte();

        Accuracy = reader.ReadByte();
        Agility = reader.ReadByte();
        HP = reader.ReadByte();
        MP = reader.ReadByte();

        AttackSpeed = reader.ReadSByte();
        Luck = reader.ReadSByte();

        if (version <= 19) return;
        SoulBoundId = reader.ReadInt32();
        byte Bools = reader.ReadByte();        
        Identified = (Bools & 0x01) == 0x01;
        Cursed = (Bools & 0x02) == 0x02;
        Strong = reader.ReadByte();
        MagicResist = reader.ReadByte();
        PoisonResist = reader.ReadByte();
        HealthRecovery = reader.ReadByte();
        ManaRecovery = reader.ReadByte();
        PoisonRecovery = reader.ReadByte();
        CriticalRate = reader.ReadByte();
        CriticalDamage = reader.ReadByte();
        Freezing = reader.ReadByte();
        PoisonAttack = reader.ReadByte();
        

        if (version <= 31) return;

        int count = reader.ReadInt32();
        for (int i = 0; i < count; i++)
        {
            if (reader.ReadBoolean()) continue;
            UserItem item = new UserItem(reader, version, Customversion);
            Slots[i] = item;
        }

        if (version <= 38) return;

        GemCount = reader.ReadUInt32();

        if (version <= 40) return;

        Awake = new Awake(reader);

        if (version <= 56) return;

        RefinedValue = (RefinedValue)reader.ReadByte();
        RefineAdded = reader.ReadByte();
        if (version < 60) return;
        WeddingRing = reader.ReadInt32();

        if (version < 65) return;

        if (reader.ReadBoolean())
        {
            ExpireInfo = new ExpireInfo(reader, version, Customversion);
        }

    }
Пример #11
0
    public UserItem(BinaryReader reader, int version = int.MaxValue, int Customversion = int.MaxValue)
    {
        UniqueID  = reader.ReadUInt64();
        ItemIndex = reader.ReadInt32();

        CurrentDura = reader.ReadUInt16();
        MaxDura     = reader.ReadUInt16();

        Count = reader.ReadUInt32();

        AC  = reader.ReadByte();
        MAC = reader.ReadByte();
        DC  = reader.ReadByte();
        MC  = reader.ReadByte();
        SC  = reader.ReadByte();

        Accuracy = reader.ReadByte();
        Agility  = reader.ReadByte();
        HP       = reader.ReadByte();
        MP       = reader.ReadByte();

        AttackSpeed = reader.ReadSByte();
        Luck        = reader.ReadSByte();

        SoulBoundId = reader.ReadInt32();
        byte Bools = reader.ReadByte();

        Identified     = (Bools & 0x01) == 0x01;
        Cursed         = (Bools & 0x02) == 0x02;
        Strong         = reader.ReadByte();
        MagicResist    = reader.ReadByte();
        PoisonResist   = reader.ReadByte();
        HealthRecovery = reader.ReadByte();
        ManaRecovery   = reader.ReadByte();
        PoisonRecovery = reader.ReadByte();
        CriticalRate   = reader.ReadByte();
        CriticalDamage = reader.ReadByte();
        Freezing       = reader.ReadByte();
        PoisonAttack   = reader.ReadByte();


        int count = reader.ReadInt32();

        for (int i = 0; i < count; i++)
        {
            if (reader.ReadBoolean())
            {
                continue;
            }
            UserItem item = new UserItem(reader, version, Customversion);
            Slots[i] = item;
        }

        GemCount = reader.ReadUInt32();

        Awake = new Awake(reader);

        RefinedValue = (RefinedValue)reader.ReadByte();
        RefineAdded  = reader.ReadByte();
        WeddingRing  = reader.ReadInt32();

        if (version < 65)
        {
            return;
        }

        if (reader.ReadBoolean())
        {
            ExpireInfo = new ExpireInfo(reader, version, Customversion);
        }

        if (version < 76)
        {
            return;
        }

        if (reader.ReadBoolean())
        {
            RentalInformation = new RentalInformation(reader, version, Customversion);
        }
    }
Пример #12
0
 public void EnemyReady(Hero hero, Awake awake)
 {
     enemyIsReady = true;
     enemyHero    = hero;
     enemyAwake   = awake;
 }
Пример #13
0
    public UserItem(BinaryReader reader, int version = int.MaxValue, int customVersion = int.MaxValue)
    {
        UniqueID  = reader.ReadUInt64();
        ItemIndex = reader.ReadInt32();

        CurrentDura = reader.ReadUInt16();
        MaxDura     = reader.ReadUInt16();

        if (version <= 84)
        {
            Count = (ushort)reader.ReadUInt32();
        }
        else
        {
            Count = reader.ReadUInt16();
        }

        if (version <= 84)
        {
            AddedStats = new Stats();

            AddedStats[Stat.MaxAC]  = reader.ReadByte();
            AddedStats[Stat.MaxMAC] = reader.ReadByte();
            AddedStats[Stat.MaxDC]  = reader.ReadByte();
            AddedStats[Stat.MaxMC]  = reader.ReadByte();
            AddedStats[Stat.MaxSC]  = reader.ReadByte();

            AddedStats[Stat.Accuracy] = reader.ReadByte();
            AddedStats[Stat.Agility]  = reader.ReadByte();
            AddedStats[Stat.HP]       = reader.ReadByte();
            AddedStats[Stat.MP]       = reader.ReadByte();

            AddedStats[Stat.AttackSpeed] = reader.ReadSByte();
            AddedStats[Stat.Luck]        = reader.ReadSByte();
        }

        SoulBoundId = reader.ReadInt32();
        byte Bools = reader.ReadByte();

        Identified = (Bools & 0x01) == 0x01;
        Cursed     = (Bools & 0x02) == 0x02;

        if (version <= 84)
        {
            AddedStats[Stat.Strong]         = reader.ReadByte();
            AddedStats[Stat.MagicResist]    = reader.ReadByte();
            AddedStats[Stat.PoisonResist]   = reader.ReadByte();
            AddedStats[Stat.HealthRecovery] = reader.ReadByte();
            AddedStats[Stat.SpellRecovery]  = reader.ReadByte();
            AddedStats[Stat.PoisonRecovery] = reader.ReadByte();
            AddedStats[Stat.CriticalRate]   = reader.ReadByte();
            AddedStats[Stat.CriticalDamage] = reader.ReadByte();
            AddedStats[Stat.Freezing]       = reader.ReadByte();
            AddedStats[Stat.PoisonAttack]   = reader.ReadByte();
        }

        int count = reader.ReadInt32();

        SetSlotSize(count);

        for (int i = 0; i < count; i++)
        {
            if (reader.ReadBoolean())
            {
                continue;
            }
            UserItem item = new UserItem(reader, version, customVersion);
            Slots[i] = item;
        }

        if (version <= 84)
        {
            GemCount = (ushort)reader.ReadUInt32();
        }
        else
        {
            GemCount = reader.ReadUInt16();
        }

        if (version > 84)
        {
            AddedStats = new Stats(reader);
        }

        Awake = new Awake(reader);

        RefinedValue = (RefinedValue)reader.ReadByte();
        RefineAdded  = reader.ReadByte();

        if (version > 85)
        {
            RefineSuccessChance = reader.ReadInt32();
        }

        WeddingRing = reader.ReadInt32();

        if (version < 65)
        {
            return;
        }

        if (reader.ReadBoolean())
        {
            ExpireInfo = new ExpireInfo(reader, version, customVersion);
        }

        if (version < 76)
        {
            return;
        }

        if (reader.ReadBoolean())
        {
            RentalInformation = new RentalInformation(reader, version, customVersion);
        }

        if (version < 83)
        {
            return;
        }

        IsShopItem = reader.ReadBoolean();
    }
 private void WatchdogInterval_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
 {
     Awake.TurnOffScreen();
 }