示例#1
0
        void SpawnBurst(Player player, Entity target, int hitDamage)
        {
            PlaySound(player);

            int   spikeCount     = 5;
            float speed          = 20;
            float halfArc        = 0.7f;
            float arc            = halfArc * 2;
            float angleIncrement = arc / (spikeCount - 1);
            float angle          = (target.Center - player.Center).ToRotation() - halfArc;
            int   damage         = (int)MathHelper.Clamp(hitDamage * Type2.GetValue(), 1, 999999);

            int spawnerBurst = spikeCount / 2;

            for (int i = 0; i < spikeCount; i++)
            {
                Vector2 velocity = angle.ToRotationVector2() * speed;
                Projectile.NewProjectile(
                    position: player.Center,
                    velocity: velocity,
                    Type: ModContent.ProjectileType <IceBurst>(),
                    Damage: damage,
                    KnockBack: 0,
                    Owner: player.whoAmI,
                    ai0: Type3.GetValue(),
                    ai1: i == spawnerBurst ? 1f : 0f);
                angle += angleIncrement;
            }
        }
示例#2
0
        public void Type_GetInterface()
        {
            Type typeBar = typeof(Bar);
            Type typeFoo = typeof(Foo);

            Type foundType = Type2.GetInterface(typeBar, "Foo");

            Assert.IsNotNull(foundType);
            Assert.AreEqual(typeFoo.FullName, foundType.FullName);
            Assert.IsTrue(foundType.IsInterface);

            foundType = Type2.GetInterface(typeBar, "foo");
            Assert.IsNull(foundType);

            foundType = Type2.GetInterface(typeBar, "Qux");
            Assert.IsNull(foundType);

            foundType = Type2.GetInterface(typeBar, "foo", true);
            Assert.IsNotNull(foundType);
            Assert.AreEqual(typeFoo.FullName, foundType.FullName);
            Assert.IsTrue(foundType.IsInterface);

            foundType = Type2.GetInterface(typeBar, "qux", true);
            Assert.IsNull(foundType);
        }
示例#3
0
 public ReturnType MyNewMethod(Tyep1 t1, Type2 t2)
 {
     //1. call to ExistingMethod1(); --> I'll just setup the return value
     //2. call to ExistingMethod2(); --> I'll just setup the return value
     //3. call using the DbContext   --> ???
     //4. call using the Logger      --> ???
 }
示例#4
0
        List <Type_2> GetType2(short count, int offset, List <Type_2> Type2, int idx)
        {
            if (Type2 == null)
            {
                Type2 = new List <Type_2>();
            }

            for (int i = 0; i < count; i++)
            {
                Type2.Add(new Type_2()
                {
                    Idx  = idx,
                    I_00 = BitConverter.ToUInt16(rawBytes, offset + 0),
                    I_02 = (ushort)(BitConverter.ToUInt16(rawBytes, offset + 2) - BitConverter.ToUInt16(rawBytes, offset + 0)),
                    I_04 = BitConverter.ToUInt16(rawBytes, offset + 4),
                    I_06 = BitConverter.ToUInt16(rawBytes, offset + 6),
                    I_08 = BitConverter.ToUInt16(rawBytes, offset + 8),
                    I_10 = BitConverter.ToUInt16(rawBytes, offset + 10),
                    I_12 = BitConverter.ToUInt16(rawBytes, offset + 12),
                    I_14 = BitConverter.ToUInt16(rawBytes, offset + 14),
                    F_16 = BitConverter.ToSingle(rawBytes, offset + 16),
                    F_20 = BitConverter.ToSingle(rawBytes, offset + 20),
                    F_24 = BitConverter.ToSingle(rawBytes, offset + 24),
                    F_28 = BitConverter.ToSingle(rawBytes, offset + 28),
                    F_32 = BitConverter.ToSingle(rawBytes, offset + 32),
                    F_36 = BitConverter.ToSingle(rawBytes, offset + 36),
                    I_40 = BitConverter.ToInt32(rawBytes, offset + 40),
                    I_44 = BitConverter.ToInt32(rawBytes, offset + 44)
                });

                offset += 48;
            }

            return(Type2);
        }
示例#5
0
        void Bleed(Player target, int hitDamage)
        {
            int damage   = (int)MathHelper.Clamp(hitDamage * Type2.GetValue(), 1, int.MaxValue);
            int duration = (int)MathHelper.Clamp(Type3.GetValue() * 60, 1, int.MaxValue);

            target.GetModPlayer <BuffPlayer>().AddBleedBuff(target, damage, duration);
        }
示例#6
0
 void Chill(Item item, Player player, Player target)
 {
     if (AffixItemItem.IsAccessoryEquipped(item, player) && Main.rand.NextFloat(1f) < Type1.GetValue())
     {
         target.GetModPlayer <BuffPlayer>().AddChilledBuff(target, Type2.GetValue(), PathOfModifiers.ailmentDuration);
     }
 }
        static void Main(string[] args)
        {
            Console.WriteLine("1. Root of n-th power by Newton's method.\nEnter the number: ");
            double num = Convert.ToDouble(Console.ReadLine());
            Type1  n   = new Type1(num);

            Console.WriteLine("Enter power and accuracy: ");
            string[] s        = Console.ReadLine().Split(" ");
            double[] settings = new double[2];
            if (s.Length == 2)
            {
                settings[0] = double.Parse(s[0]); settings[1] = double.Parse(s[1]);
            }
            else
            {
                Array.Resize(ref s, 2); s[1] = Console.ReadLine(); settings[0] = double.Parse(s[0]); settings[1] = double.Parse(s[1]);
            }
            Console.WriteLine("{0} power root from {1} with accuracy {2} = {3}", num, settings[0], settings[1], n.RootN(settings[0], settings[1]));
            Console.WriteLine("//Real root = {0}\n", n.CheckRootN(settings[0]));


            Console.WriteLine("\n2. Binary representation of a number.\nEnter the number:");
            int   num1 = Convert.ToInt32(Console.ReadLine());
            Type2 n1   = new Type2(num1);

            Console.WriteLine("{0} (10) = {1} (2)", num1, n1.MyBinary());
            Console.WriteLine("{0} (10) = {1} (2) /Check/\n", num1, n1.Binary());
        }
示例#8
0
 public void Type_IsSerializable()
 {
     Assert.IsTrue(Type2.IsSerializable(typeof(Bar)));
     Assert.IsFalse(Type2.IsSerializable(typeof(NotSerializableClass)));
     Assert.IsFalse(Type2.IsSerializable(typeof(Foo)));
     Assert.IsFalse(Type2.IsSerializable(typeof(Qux)));
 }
 void Shock(Item item, Player player, NPC target)
 {
     if (AffixItemItem.IsAccessoryEquipped(item, player) && Main.rand.NextFloat(1f) < Type1.GetValue())
     {
         target.GetGlobalNPC <BuffNPC>().AddShockedBuff(target, Type2.GetValue(), PathOfModifiers.ailmentDuration);
     }
 }
示例#10
0
        private static async Task <string> MyMethodAsync(int input)
        {
            int local = input;

            Console.WriteLine("this is MyMethodAsync,threadId is {0}", Thread.CurrentThread.ManagedThreadId);
            try
            {
                string type1 = await MethodAsync1();

                var len = type1.Length;

                Console.WriteLine("this is type1 c,type1 is {0}", type1);
                for (int i = 0; i < 3; i++)
                {
                    Type2 type2 = await MethodAsync2();

                    Console.WriteLine("this is for,threadId is {0}", Thread.CurrentThread.ManagedThreadId);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
            finally
            {
                Console.WriteLine("finally");
            }
            return("done");
        }
示例#11
0
        public ShipSlotData(SlotItemInfo item, int maximum = -1, int current = -1)
        {
            this.Source   = item;
            this.Maximum  = maximum;
            this._Current = current;

            if (item == null)
            {
                return;
            }

            var m = Plugin.RawStart2.api_mst_slotitem.SingleOrDefault(x => x.api_id == item.Id);

            if (m == null)
            {
                return;
            }
            this.Armer     = m.api_souk;
            this.Firepower = m.api_houg;
            this.Torpedo   = m.api_raig;
            this.Bomb      = m.api_baku;
            this.AA        = m.api_tyku;
            this.ASW       = m.api_tais;
            this.Hit       = m.api_houm;
            this.Evade     = m.api_houk;
            this.LOS       = m.api_saku;
            this.Type2     = (Type2)m.api_type[1];
        }
示例#12
0
 void ModifyDamage(Item item, Player player, ref float damageMultiplier)
 {
     if (item == player.HeldItem && TryConsumeMana(player))
     {
         damageMultiplier += Type2.GetValue();
     }
 }
示例#13
0
        void GainMoveSpeed(Player player)
        {
            int duration = (int)MathHelper.Clamp(Type2.GetValue() * 60, 1, 9999999);

            player.GetModPlayer <BuffPlayer>().AddWeaponMoveSpeedBuff(player, Type1.GetValue(), duration);
            lastProcTime = Main.GameUpdateCount;
        }
示例#14
0
        static UnityEventReflector()
        {
            // ReSharper disable PossibleNullReferenceException
            var baseType = typeof(UnityEventBase);

            var m_RebuildPersistentCallsIfNeeded = baseType.GetMethod(
                "RebuildPersistentCallsIfNeeded",
                BindingFlags.Instance | BindingFlags.NonPublic
                );

            rebuildPersistentCallsIfNeeded =
                ue => m_RebuildPersistentCallsIfNeeded.Invoke(ue, noArgs);

            var f_PersistentCalls = baseType.GetField(
                "m_PersistentCalls",
                BindingFlags.Instance | BindingFlags.NonPublic
                );

            persistentCalls = ue => new PersistentCallGroup(f_PersistentCalls.GetValue(ue));

            var persistentCallType = Type2.getType(UnityEngineEventsPersistentCall).rightOrThrow;
            var m_methodInfo       =
                typeof(UnityEventBase).GetMethod(
                    "FindMethod",
                    BindingFlags.Instance | BindingFlags.NonPublic,
                    Type.DefaultBinder,
                    new[] { persistentCallType },
                    null
                    );

            findMethod = (ue, pc) => F.opt((MethodInfo)m_methodInfo.Invoke(ue, new [] { pc.obj }));

            // ReSharper restore PossibleNullReferenceException
        }
示例#15
0
        public ShipSlotData(SlotItemInfo item, int maximum = -1, int current = -1)
        {
            this.Source   = item;
            this.Maximum  = maximum;
            this._Current = current;

            if (item == null)
            {
                return;
            }

            var m = DataStorage.Instance.Master.SlotItems
                    .Select(x => x.Value)
                    .SingleOrDefault(x => x.Id == item.Id);

            if (m == null)
            {
                return;
            }

            this.Armor     = m.Armor;
            this.Firepower = m.Firepower;
            this.Torpedo   = m.Torpedo;
            this.Bomb      = m.Bomb;
            this.AA        = m.AA;
            this.ASW       = m.ASW;
            this.Hit       = m.Hit;
            this.Evade     = m.Evade;
            this.LOS       = m.ViewRange;
            this.Type2     = (Type2)m.RawData.api_type[1];
        }
 public static string Method(Type1 a, Type2 b, Type3 c, Type4 d)
 {
     a = a ?? default1;
     b = b ?? default2;
     c = c ?? default3;
     d = d ?? default4;
     //do smth
 }
示例#17
0
        void Bleed(NPC target, int hitDamage)
        {
            int     damage   = (int)MathHelper.Clamp(hitDamage * Type2.GetValue(), 1, int.MaxValue);
            int     duration = (int)MathHelper.Clamp(Type3.GetValue() * 60, 1, int.MaxValue);
            BuffNPC pomNPC   = target.GetGlobalNPC <BuffNPC>();

            pomNPC.AddBleedBuff(target, damage, duration);
        }
示例#18
0
 void Hit(Item item, Player player, Player target)
 {
     if (item == player.HeldItem && Main.rand.NextFloat(1) < Type1.GetValue())
     {
         int durationTicks = (int)Math.Round(Type2.GetValue() * 60);
         target.AddBuff(BuffID.Confused, durationTicks, false);
     }
 }
示例#19
0
 void GainDodgeChance(Item item, Player player)
 {
     if (AffixItemItem.IsArmorEquipped(item, player) && (Main.GameUpdateCount - lastProcTime) >= (int)Math.Round(Type3.GetValue() * 60))
     {
         int durationTicks = (int)Math.Round((Type2.GetValue() * 60));
         player.GetModPlayer <BuffPlayer>().AddDodgeChanceBuff(player, Type1.GetValue(), durationTicks, false);
         lastProcTime = Main.GameUpdateCount;
     }
 }
示例#20
0
 public void Execute(string xmlData)
 {
     Type2  type2Object = (new Deserializer <Type2>()).XML2Object(XML);
     var    ws          = new WSProxy2();
     string response    = ws.Method1(type2Object);
     //
     // lots of other lines of code that use type1VO, type1Object, the response, etc.
     //
 }
        public override bool PreHurt(Item item, Player player, bool pvp, bool quiet, ref float damageMultiplier, ref int hitDirection, ref bool crit, ref bool customDamage, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource)
        {
            if (AffixItemItem.IsAccessoryEquipped(item, player) && TryConsumeMana(player))
            {
                damageMultiplier += Type2.GetValue();
            }

            return(true);
        }
示例#22
0
    static void Main(string[] args)
    {
        Type1 something1 = new Type1();
        Type2 something2 = new Type2();

        something1.runTest();
        something2.runTest();
        Console.ReadKey();
    }
示例#23
0
        internal static Dungeon GetDungeon(int id)
        {
            MySqlConnection conn = GetDBConnection();

            conn.Open();

            string       sql     = "SELECT type FROM Quest WHERE id ='" + id + "';"; //проверить названия колонок в таблице
            MySqlCommand command = new MySqlCommand(sql, conn);

            int type = Convert.ToInt32(command.ExecuteScalar());

            conn.Close();
            Dungeon dungeon = new Type3();

            switch (type)
            {
            case 1:
                dungeon = new Type1();
                break;

            case 2:
                dungeon = new Type2();
                break;

            case 3:
                dungeon = new Type3();
                break;

            default:
                Console.WriteLine("Ooopss...");
                break;
            }

            //присваеваем всем полям данжна значения бд
            conn.Open();

            sql     = "SELECT * FROM Quest WHERE id ='" + id + "';"; //проверить названия колонок в таблице
            command = new MySqlCommand(sql, conn);

            MySqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                dungeon.id        = id;
                dungeon.mainText  = Convert.ToString(reader[2]);
                dungeon.type      = Convert.ToInt32(reader[1]);
                dungeon.answ1     = Convert.ToString(reader[3]);
                dungeon.answ2     = Convert.ToString(reader[4]);
                dungeon.answ3     = Convert.ToString(reader[5]);
                dungeon.reaction1 = Convert.ToString(reader[6]);
                dungeon.reaction2 = Convert.ToString(reader[7]);
                dungeon.reaction3 = Convert.ToString(reader[8]);
            }
            conn.Close();
            return(dungeon);
        }
示例#24
0
        public void CreateType2(string type2Name)
        {
            Type2 newRype2 = new Type2()
            {
                Name     = type2Name,
                ClientID = AppContext.GetCID()
            };

            _context.Type2s.InsertOnSubmit(newRype2);
        }
示例#25
0
 static void Main(string[] args)
 {
     var cv = new ConverterDictionary();
     var type2_converter = cv.GetConverter <Type2, Type2_New>();
     var converterF      = type2_converter.Compile();
     var type2           = new Type2 {
         Field1 = "Hello", Field2 = "World"
     };
     var type2_New = converterF(type2);
 }
示例#26
0
        void SpawnLightningBolt(Player player, Entity target, int hitDamage)
        {
            float   height   = 512;
            Vector2 position = target.Center + Main.rand.NextVector2Circular(target.width, target.height) - new Vector2(0, height);

            PlaySound(position);

            int damage = (int)MathHelper.Clamp(hitDamage * Type2.GetValue(), 1, 999999);

            Projectile.NewProjectile(position, Vector2.Zero, ModContent.ProjectileType <LightningBolt>(), damage, 0, player.whoAmI, Type3.GetValue(), height);
        }
示例#27
0
 public void Test3()
 {
     unsafe
     {
         IntPtr iptr  = Marshal.AllocHGlobal(1024);
         Type2  type2 = Marshal.PtrToStructure <Type2>(iptr);
         //void* ptr = iptr.ToPointer();
         //*((Type1*)ptr) = new Type();
         Assert.IsTrue(new Type2().Equals(type2));
     }
 }
示例#28
0
 private static void Demo2()
 {
     // Force the code in the finally to be eagerly prepared
     RuntimeHelpers.PrepareConstrainedRegions();
     try {
         Console.WriteLine("In try");
     } finally {
         // Type2’s static constructor is implicitly called in here
         Type2.M();
     }
 }
示例#29
0
        private static async Task <Type2> Method2Async()
        {
            Type2 t = null;
            await Task.Run(new Action(() =>
            {
                t = new Type2();
                Thread.Sleep(1000);
            }));

            return(t);
        }
        public void DoesNotEnforceUniquenessAcrossTypes ()
        {
            var sagaStorage = new InMemorySagaStorage();

            var recycledId = "recycled-id";

            var instanceOfType1 = new Type1 {Id = Guid.NewGuid(), Revision = 0, CorrelationId = recycledId};
            var instanceOfType2 = new Type2 { Id = Guid.NewGuid(), Revision = 0, CorrelationId = recycledId };

            sagaStorage.Insert(instanceOfType1, For(typeof(Type1))).Wait();
            sagaStorage.Insert(instanceOfType2, For(typeof(Type2))).Wait();
        }
示例#31
0
    private void Awake()
    {
        if (gameObject.CompareTag(_PROJECTILE1_TAG))
        {
            _type1 = gameObject.GetComponent <Type1>();
        }

        if (gameObject.CompareTag(_PROJECTILE2_TAG))
        {
            _type2 = gameObject.GetComponent <Type2>();
        }
    }
示例#32
0
        public ShipSlotData(SlotItemInfo item, int maximum = -1, int current = -1)
        {
            this.Source = item;
            this.Maximum = maximum;
            this._Current = current;

            if (item == null) return;

            var m = Plugin.RawStart2.api_mst_slotitem.SingleOrDefault(x => x.api_id == item.Id);
            if (m == null) return;
            this.Armer = m.api_souk;
            this.Firepower = m.api_houg;
            this.Torpedo = m.api_raig;
            this.Bomb = m.api_baku;
            this.AA = m.api_tyku;
            this.ASW = m.api_tais;
            this.Hit = m.api_houm;
            this.Evade = m.api_houk;
            this.LOS = m.api_saku;
            this.Type2 = (Type2)m.api_type[1];
        }
示例#33
0
 public static int Count(this ShipData data, Type2 type2)
 {
     return data.Slots.Count(x => x.Type2 == type2);
 }
示例#34
0
 public void Method(Type2 item)
 {
     Console.WriteLine("Type2");
 }
示例#35
0
   // This is the state machine method itself
   void IAsyncStateMachine.MoveNext() {
      String result = null;   // Task's result value

      // Compiler-inserted try block ensures the state machine's task completes
      try {
         Boolean executeFinally = true;   // Assume we're logically leaving the 'try' block
         if (m_state == -1) {             // If 1st time in state machine method,
            m_local = m_argument;         // execute start of original method
         }

         // Try block that we had in our original code
         try {
            TaskAwaiter<Type1> awaiterType1;
            TaskAwaiter<Type2> awaiterType2;

            switch (m_state) {
               case -1: // Start execution of code in 'try'
                  // Call Method1Async and get its awaiter
                  awaiterType1 = Method1Async().GetAwaiter();
                  if (!awaiterType1.IsCompleted) {
                     m_state = 0;                   // 'Method1Async' is completing
                                                    // asynchronously
                     m_awaiterType1 = awaiterType1; // Save the awaiter for when we come back

                     // Tell awaiter to call MoveNext when operation completes
                     m_builder.AwaitUnsafeOnCompleted(ref awaiterType1, ref this);
                     // The line above invokes awaiterType1's OnCompleted which approximately
                     // calls ContinueWith(t => MoveNext()) on the Task being awaited.
                     // When the Task completes, the ContinueWith task calls MoveNext

                     executeFinally = false;        // We're not logically leaving the 'try'
                                                    // block
                     return;                        // Thread returns to caller
                  }
                  // 'Method1Async' completed synchronously
                  break;

               case 0:  // 'Method1Async' completed asynchronously
                  awaiterType1 = m_awaiterType1;  // Restore most-recent awaiter
                  break;

               case 1:  // 'Method2Async' completed asynchronously
                  awaiterType2 = m_awaiterType2;  // Restore most-recent awaiter
                  goto ForLoopEpilog;
            }

            // After the first await, we capture the result & start the 'for' loop
            m_resultType1 = awaiterType1.GetResult(); // Get awaiter's result

         ForLoopPrologue:
            m_x = 0;          // 'for' loop initialization
            goto ForLoopBody; // Skip to 'for' loop body

         ForLoopEpilog:
            m_resultType2 = awaiterType2.GetResult();
            m_x++;            // Increment x after each loop iteration
            // Fall into the 'for' loop's body

         ForLoopBody:
            if (m_x < 3) {  // 'for' loop test
               // Call Method2Async and get its awaiter
               awaiterType2 = Method2Async().GetAwaiter();
               if (!awaiterType2.IsCompleted) {
                  m_state = 1;                   // 'Method2Async' is completing asynchronously
                  m_awaiterType2 = awaiterType2; // Save the awaiter for when we come back

                  // Tell awaiter to call MoveNext when operation completes
                  m_builder.AwaitUnsafeOnCompleted(ref awaiterType2, ref this);
                  executeFinally = false;        // We're not logically leaving the 'try' block
                  return;                        // Thread returns to caller
               }
               // 'Method2Async' completed synchronously
               goto ForLoopEpilog;  // Completed synchronously, loop around
            }
         }
         catch (Exception) {
            Console.WriteLine("Catch");
         }
         finally {
            // Whenever a thread physically leaves a 'try', the 'finally' executes
            // We only want to execute this code when the thread logically leaves the 'try
'
            if (executeFinally) {
               Console.WriteLine("Finally");
            }
         }
         result = "Done"; // What we ultimately want to return from the async function
      }
      catch (Exception exception) {
         // Unhandled exception: complete state machine's Task with exception
         m_builder.SetException(exception);
         return;
      }
      // No exception: complete state machine's Task with result
      m_builder.SetResult(result);
   }