コード例 #1
0
    public static void SpecialRoom(Dungeon d, Creature p, Event[] Event)
    {
        foreach (Event e in Event)
        {
            int a = e.eventType;
            switch (a)
            {
            case 1:
                SpecialEvent.Event1(d, p, e);
                break;

            case 2:
                SpecialEvent.Event2(d, p, e);
                break;

            case 3:
                SpecialEvent.Event3(d, p, e);
                break;

            case 4:
                SpecialEvent.Event4(d, p, e);
                break;
            }
        }
    }
コード例 #2
0
ファイル: ZooInfoUnitTests.cs プロジェクト: gilabadi/Zoo-App
        public void UpdateSpecialEventsValidInput()
        {
            var specialEvents = context.GetAllSpecialEvents((int)Languages.en);

            Assert.AreEqual(2, specialEvents.Count());

            SpecialEvent eve = new SpecialEvent
            {
                id          = 2,
                title       = "title1",
                description = "Kaki1",
                startDate   = new DateTime(2018, 3, 5),
                endDate     = new DateTime(2018, 3, 8),
                language    = (int)Languages.en
            };

            var oldDescription = eve.description;

            eve.description = "New Event";

            context.UpdateSpecialEvent(eve, false);

            specialEvents = context.GetAllSpecialEvents((int)Languages.en);
            Assert.AreEqual(2, specialEvents.Count());
            Assert.IsTrue(specialEvents.Any(se => se.description == eve.description));
            Assert.IsFalse(specialEvents.Any(se => se.description == oldDescription));
        }
コード例 #3
0
ファイル: ZooInfoController.cs プロジェクト: gilabadi/Zoo-App
        public void UpdateSpecialEvent(SpecialEvent specialEvent, bool isPush)
        {
            try
            {
                using (var db = GetContext())
                {
                    if (ValidateSessionId(db))
                    {
                        db.UpdateSpecialEvent(specialEvent, isPush);
                    }
                    else
                    {
                        throw new AuthenticationException("Couldn't validate the session");
                    }
                }
            }
            catch (Exception Exp)
            {
                var specialInput = "Id: " + specialEvent.id + ", title: " + specialEvent.title +
                                   ", description: " + specialEvent.description + ", start date: " + specialEvent.startDate +
                                   ", end date: " + specialEvent.endDate + ", image Url: " + specialEvent.imageUrl +
                                   ", language: " + specialEvent.language + ", is push: " + isPush;

                Logger.GetInstance(isTesting).WriteLine(Exp.Message, Exp.StackTrace, "Special Event:" + specialInput);
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
        }
コード例 #4
0
        private void EreignisEintragen()
        {
            var neu = false;

            if (!(Zuteilung is SpecialEvent ev))
            {
                ev = new SpecialEvent()
                {
                    Kw = Kalenderwoche
                };
                neu = true;
            }
            var dialog = new EreignisEintragenCommandDialog();
            var data   = (EreignisEintragenCommandDialogView)dialog.DataContext;

            data.Event = ev;

            dialog.ShowDialog();

            if (data.Speichern)
            {
                if (neu)
                {
                    DataContainer.MeinPlanAdd(ev);
                }
                ActivityLog.AddActivity.EreignisBearbeiten(ev, neu ? ActivityLog.Types.EreignisAnlegen : ActivityLog.Types.EreignisBearbeiten);
                Zuteilung = ev;
                Monat.GetWeeks(Jahr);
            }
        }
コード例 #5
0
ファイル: MainGameMode.cs プロジェクト: DLBL0624/CSCI529
 public void HandleNextEvent()
 {
     if (UnHandledEvent.Count > 0)
     {
         SpecialEvent head = UnHandledEvent.Dequeue();
         pEventMgr.RemoveListener(head.EventId);
         foreach (string action in head.actions)
         {
             string[] cmd = action.Split(',');
             if (cmd[0] == "dialog")
             {
                 DialogManager dm = pUIMgr.ShowPanel("DialogManager") as DialogManager;
                 if (dm == null)
                 {
                     Debug.LogError("dialog mgr load fail");
                 }
                 dm.StartDialog(cmd[1], delegate(string[] args)
                 {
                     HandleNextEvent();
                 });
             }
             else if (cmd[0] == "event")
             {
                 pEventMgr.AddListener(cmd[1]);
             }
         }
     }
 }
コード例 #6
0
    public EventData(int seed, int checkpoints, Gamemode gmode, SpecialEvent spEvent = SpecialEvent.None, string customName = "", string customDesc = "")
    {
        m_new = true;

        m_special         = spEvent;
        m_gameMode        = gmode;
        m_eventSeed       = seed;
        m_checkPoints     = checkpoints;
        m_customEventName = customName;
        m_customEventDesc = customDesc;
        m_seasonalEvent   = true;
        m_canBeRestarted  = true;
        m_eventLeague     = 16;

        m_rewardType = 0;

        SetEventRules();
        SetEventObjectives();

        UnityEngine.Random.InitState(m_eventSeed);
        int curveChance = UnityEngine.Random.Range(10, 71);
        int minStraight = UnityEngine.Random.Range(0, 3);
        int maxStraight = UnityEngine.Random.Range(minStraight, 8);

        m_startingHour = UnityEngine.Random.Range(0f, 24f);

        // Difficulty bonus setting.
        m_roadDifficulty = ((curveChance - 10f) / 70f) * 3f; m_roadDifficulty += 1 - (minStraight / 3f); m_roadDifficulty += 1 - (maxStraight / 8f);



        m_rewardValue = 0;
    }
コード例 #7
0
        public static void EreignisBearbeiten(SpecialEvent ereignis, Types typ)
        {
            if (ereignis == null)
            {
                return;
            }

            var objekt = (!string.IsNullOrEmpty(ereignis.Name))
                ? $"Ereignis: {ereignis.Name}{Environment.NewLine}"  //EventName
                : $"Ereignis: { ereignis.Typ}{Environment.NewLine}"; //EventName

            if (!string.IsNullOrEmpty(ereignis.Vortragender))
            {
                objekt += $"Redner: {ereignis.Vortragender}{Environment.NewLine}"; //Redner
            }
            if (ereignis.Vortrag == null && !string.IsNullOrEmpty(ereignis.Thema))
            {
                objekt += $"Thema: {ereignis.Thema}";
            }

            var log = new Activity
            {
                Typ         = typ,
                Versammlung = DataContainer.MeineVersammlung,
                KalenderKw  = ereignis?.Kw ?? -1,
                Vortrag     = ereignis.Vortrag?.Vortrag,
                Objekt      = objekt
            };

            Add(log);
        }
コード例 #8
0
 public void SpecialEvents_Add(SpecialEvent item)
 {
     using (eRestaurantContext context = new eRestaurantContext())
     {
         var added = context.SpecialEvents.Add(item);
         context.SaveChanges();
     }
 }
コード例 #9
0
 public void SpecialEvents_Update(SpecialEvent item)
 {
     using (eRestaurantContext context = new eRestaurantContext())
     {
         context.Entry <SpecialEvent>(context.SpecialEvents.Attach(item)).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
コード例 #10
0
 public void UpdateSpecialEvent(SpecialEvent Entities)
 {
     using (RestaurantContext specialEventDBContext = new RestaurantContext())
     { var updating = specialEventDBContext.SpecialEvents.Attach(Entities);
       var matchingWithExistingValues = specialEventDBContext.Entry <SpecialEvent>(updating);
       matchingWithExistingValues.State = System.Data.Entity.EntityState.Modified;
       specialEventDBContext.SaveChanges(); }
 }
コード例 #11
0
 public void AddSpecialEvent(SpecialEvent item)
 {
     using (RestaurantContext context = new RestaurantContext())
     {
         // TODO: Validation of SpecialEvent data....
         var added = context.SpecialEvents.Add(item);
         context.SaveChanges();
     }
 }
コード例 #12
0
 public void SpecialEvents_Delete(SpecialEvent item)
 {
     using (eResturauntContext context = new eResturauntContext())
     {
         SpecialEvent existing = context.SpecialEvents.Find(item.EventCode);
         context.SpecialEvents.Remove(existing);
         context.SaveChanges();
     }
 }
コード例 #13
0
 public void DeleteSpecialEvent(SpecialEvent item)
 {
     using (RestaurantContext context = new RestaurantContext())
     {
         var existing = context.SpecialEvents.Find(item.EventCode);
         context.SpecialEvents.Remove(existing);
         context.SaveChanges();
     }
 }
コード例 #14
0
 public void DeleteSpecialEvent(SpecialEvent Entities)
 {
     using (RestaurantContext specialEventDBContext = new RestaurantContext())
     {
         var existingvalue = specialEventDBContext.SpecialEvents.Find(Entities.EventCode);
         // remember to add the DataKeyNames for delete and update
         specialEventDBContext.SpecialEvents.Remove(existingvalue);
         specialEventDBContext.SaveChanges();
     }
 }
コード例 #15
0
ファイル: Line.cs プロジェクト: stron333/courseDex
 public void Dispose()
 {
     if (SpecialEvent != null)
     {
         foreach (EventHandler <SpecialEventArgs> ev in SpecialEvent.GetInvocationList())
         {
             SpecialEvent -= ev;
         }
     }
 }
コード例 #16
0
ファイル: AdminController.cs プロジェクト: xdu3/InClassDemo
 public void SpecialEvent_Add(SpecialEvent item)
 {
     using (eRestaurantContext context = new eRestaurantContext())
     {
         SpecialEvent added = null;
         added = context.SpecialEvents.Add(item);
         //comment is not used until it is actully save
         context.SaveChanges();
     }
 }
コード例 #17
0
 public string AddSpecialEvent(SpecialEvent item)
 {
     using (RestaurantContext context = new RestaurantContext())
     {
         //TODO: Validation rules...
         var added = context.SpecialEvents.Add(item);
         context.SaveChanges();
         return(added.EventCode);
     }
 }
コード例 #18
0
 public void UpdateItem(SpecialEvent item)
 {
     using (RestaurantContext context = new RestaurantContext())
     {
         var attached = context.SpecialEvents.Attach(item);
         var matchingWithExistingValues = context.Entry <SpecialEvent>(attached);
         matchingWithExistingValues.State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
コード例 #19
0
 public void UpdateSpecialEvent(SpecialEvent item)
 {
     using (RestaurantContext context = new RestaurantContext())
     {
         // TODO: Validation...
         var attached = context.SpecialEvents.Attach(item);
         var existing = context.Entry <SpecialEvent>(attached);
         existing.State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
コード例 #20
0
        public void SpecialEvents_Update(SpecialEvent item)
        {
            using (eRestaurantContext context = new eRestaurantContext())
            {
                //indicate the updating instance, alter the modified status flag for this instance
                context.Entry <SpecialEvent>(context.SpecialEvents.Attach(item)).State = System.Data.Entity.EntityState.Modified;

                //command not executed until saved
                context.SaveChanges();
            }
        }
コード例 #21
0
 public void SpecialEvents_Add(SpecialEvent item)
 {
     using (eRestaurantContext context = new eRestaurantContext())
     {
         SpecialEvent added = null;
         added = context.SpecialEvents.Add(item);
         context.SaveChanges();                                                  //Commits the add to the database.
                                                                                 //Furthermore, this evaluates the annotations (validates) on the entity.
                                                                                 //Included: [Required], [StringLength], [Range], etc.
     }
 }
コード例 #22
0
 public void UpdateSpecialEvent(SpecialEvent item)
 {
     using (RestaurantContext context = new RestaurantContext())
     {
         // Validation
         var attatched = context.SpecialEvents.Attach(item);
         var matchingWithExistingValues = context.Entry <SpecialEvent>(attatched); // Lookup info about a object in the database
         matchingWithExistingValues.State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
コード例 #23
0
 public void SpecialEvents_Add(SpecialEvent item)
 {
     using (eResturauntContext context = new eResturauntContext())
     {
         SpecialEvent added = null;
         added = context.SpecialEvents.Add(item);
         // commits the add to the database
         // evaluates the anotations(validations) on your entity
         //[Required],[StringLength],[Range]...
         context.SaveChanges();
     }
 }
コード例 #24
0
 public void SpecialEvents_Delete(SpecialEvent item)
 {
     using (eRestaurantContext context = new eRestaurantContext())
     {
         //look up the item instance on the database to determi8nje if the instance exist
         SpecialEvent existing = context.SpecialEvents.Find(item.EventCode);
         //set up the delete request command
         context.SpecialEvents.Remove(existing);
         //commit the action to happen
         context.SaveChanges();
     }
 }
コード例 #25
0
ファイル: AdminController.cs プロジェクト: jyan6/InClassDemo
 public void SpecialEvents_Delete(SpecialEvent item)
 {
     using (eRestaurantContext context = new eRestaurantContext())
     {
         //lookup the instance and record if found
         SpecialEvent existing = context.SpecialEvents.Find(item.EventCode);
         //setup the command to execute the delete
         context.SpecialEvents.Remove(existing);
         //command is not executed until it is actually saved
         context.SaveChanges();
     }
 }
コード例 #26
0
 public void SpecialEvent_Delete(SpecialEvent item)
 {
     using (eRestaurantContext context = new eRestaurantContext())
     {
         // indicate the updateing item instance
         //alter the Modified Status flag for this instance
         SpecialEvent existing = context.SpecialEvents.Find(item.EventCode);
         // set up the command to execute the delete
         context.SpecialEvents.Remove(existing);
         //command is not executed until it it actually saved.
         context.SaveChanges();
     }
 }
コード例 #27
0
ファイル: ZooInfoUnitTests.cs プロジェクト: gilabadi/Zoo-App
        public void DeleteSpecialEventValidInput()
        {
            var specialEvents = context.GetAllSpecialEvents((int)Languages.he);

            Assert.AreEqual(2, specialEvents.Count());

            SpecialEvent eve = specialEvents.SingleOrDefault(se => se.title == "אירועי פורים");

            context.DeleteSpecialEvent(eve.id);

            specialEvents = context.GetAllSpecialEvents((int)Languages.he);
            Assert.AreEqual(1, specialEvents.Count());
        }
コード例 #28
0
 public void InsertOrUpdate(SpecialEvent SpecialEvent)
 {
     if (SpecialEvent.Id == default(int))
     {
         // New entity
         _context.SpecialEvents.Add(SpecialEvent);
     }
     else
     {
         // Existing entity
         _context.Entry(SpecialEvent).State = EntityState.Modified;
     }
 }
コード例 #29
0
        public void DeleteSpecialEventValidInput()
        {
            var specialEvents = ZooInfoController.GetAllSpecialEvents();

            Assert.AreEqual(2, specialEvents.Count());

            SpecialEvent eve = specialEvents.SingleOrDefault(se => se.title == "אירועי פורים");

            ZooInfoController.DeleteSpecialEvent(eve.id);

            specialEvents = ZooInfoController.GetAllSpecialEvents();
            Assert.AreEqual(1, specialEvents.Count());
        }
コード例 #30
0
 public void SpecialEvents_Add(SpecialEvent item)
 {
     using (eRestaurantContext context = new eRestaurantContext())
     {
         //these methods are execute using an instance level item
         //set up a instance pointer and initialize to null
         SpecialEvent added = null;
         //setup the command to execute the add
         added = context.SpecialEvents.Add(item);
         //command is not executed until it is actually saved.
         context.SaveChanges();
     }
 }