private void AddNewNote()
        {
            var service = new SupportService(User);

            List <String> noteTypes = service.GetNoteTypesForCategory(TraitCategory.ToString());

            var picklist = new PickListWindow(User, "Choose a note type...", () => {
                return(noteTypes);
            }, (text) => {
                noteTypes.Add(text);
                return(true);
            });

            picklist.Owner = this.FindParentWindow();
            if (picklist.ShowDialog().ValueOrFalse())
            {
                Note note = new Note();
                note.NoteID       = -1;
                note.NoteType     = picklist.SelectedValue as String;
                note.NoteCategory = TraitCategory.ToString();
                note.IntraCatID   = Owner.ObjectID.Value;
                note.NoteRTF      = "New Note";

                NoteViewModel viewModel = new NoteViewModel(note);
                _model.Add(viewModel);
                RegisterUniquePendingChange(new InsertNoteCommand(note, Owner));
                RedrawNotes(viewModel);
            }
        }
        public ActionResult DeleteConfirmed(int id)
        {
            TraitCategory traitCategory = db.TraitCategories.Find(id);

            db.TraitCategories.Remove(traitCategory);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "TraitID,TraitName,TraitDescription")] TraitCategory traitCategory)
 {
     if (ModelState.IsValid)
     {
         db.Entry(traitCategory).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(traitCategory));
 }
        public ActionResult Create([Bind(Include = "TraitID,TraitName,TraitDescription")] TraitCategory traitCategory)
        {
            if (ModelState.IsValid)
            {
                db.TraitCategories.Add(traitCategory);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(traitCategory));
        }
 public bool DeepEquals(DestinyTraitDefinition other)
 {
     return(other != null &&
            DisplayProperties.DeepEquals(other.DisplayProperties) &&
            TraitCategoryId == other.TraitCategoryId &&
            TraitCategory.DeepEquals(other.TraitCategory) &&
            Blacklisted == other.Blacklisted &&
            Hash == other.Hash &&
            Index == other.Index &&
            Redacted == other.Redacted);
 }
Exemplo n.º 6
0
        public List <string> GetTraitNames(TraitCategory category = TraitCategory.NULL)
        {
            List <string> retVal = new List <string>();

            foreach (Trait trait in allTraits)
            {
                if (category == TraitCategory.NULL || category == trait.category)
                {
                    retVal.Add(trait.traitName);
                }
            }
            return(retVal);
        }
        // GET: TraitCategories/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TraitCategory traitCategory = db.TraitCategories.Find(id);

            if (traitCategory == null)
            {
                return(HttpNotFound());
            }
            return(View(traitCategory));
        }
        private void LoadNotesPanel(NoteViewModel selected = null)
        {
            using (new OverrideCursor(Cursors.Wait)) {
                var service = new SupportService(User);
                var list    = service.GetNotes(TraitCategory.ToString(), Owner.ObjectID.Value);
                _model = new ObservableCollection <NoteViewModel>(list.ConvertAll((model) => {
                    var viewModel          = new NoteViewModel(model);
                    viewModel.DataChanged += new DataChangedHandler(viewModel_DataChanged);
                    return(viewModel);
                }));

                RedrawNotes(selected);

                IsPopulated = true;
            }
        }
Exemplo n.º 9
0
 public List <Trait> GetTraits(TraitCategory category = TraitCategory.NULL)
 {
     if (category == TraitCategory.NULL)
     {
         return(allTraits);
     }
     else
     {
         List <Trait> retVal = new List <Trait>();
         foreach (Trait t in allTraits)
         {
             if (t.category == category)
             {
                 retVal.Add(t);
             }
         }
         return(retVal);
     }
 }
 public void Populate()
 {
     if (!IsPopulated && !_rdeMode)
     {
         if (Owner.ObjectID.HasValue && Owner.ObjectID.Value >= 0)
         {
             SupportService service   = new SupportService(User);
             var            list      = service.GetTraits(TraitCategory.ToString(), Owner.ObjectID.Value);
             var            modellist = list.Select((t) => {
                 return(new TraitViewModel(t));
             });
             _model = new List <TraitViewModel>(modellist);
         }
         else
         {
             _model = new List <TraitViewModel>();
         }
         ReloadTraitPanel();
         IsPopulated = true;
     }
 }
        private void AddNewTrait()
        {
            var service = new SupportService(User);

            List <String> traitTypes = service.GetTraitNamesForCategory(TraitCategory.ToString());

            var picklist = new PickListWindow(User, "Choose a trait type...", () => {
                return(traitTypes);
            }, (text) => {
                traitTypes.Add(text);
                return(true);
            });

            picklist.Owner = this.FindParentWindow();
            if (picklist.ShowDialog().ValueOrFalse())
            {
                var existing = FindTraitByName(picklist.SelectedValue as string);
                if (existing == null)
                {
                    Trait t = new Trait();
                    t.TraitID    = -1;
                    t.Value      = "<New Trait Value>";
                    t.Category   = TraitCategory.ToString();
                    t.IntraCatID = Owner.ObjectID.Value;
                    t.Name       = picklist.SelectedValue as string;

                    TraitViewModel viewModel = new TraitViewModel(t);
                    _model.Add(viewModel);
                    RegisterUniquePendingChange(new UpdateTraitDatabaseCommand(t, Owner));
                    ReloadTraitPanel();

                    SelectTrait(viewModel);
                }
                else
                {
                    SelectTrait(existing);
                }
            }
        }
 public void MapValues()
 {
     TraitCategory.TryMapValue();
 }
 protected override void ProcessImpl(User user) {
     var service = new SupportService(user);
     service.UpdateMultimediaLink(Model.MultimediaLinkID, TraitCategory.ToString() , Model.MultimediaType, Model.Caption);
 }
Exemplo n.º 14
0
    public void Initialise(GameState state)
    {
        //field checks
        Debug.Assert(string.IsNullOrEmpty(tagGlobalAIName) == false, "Invalid tagGlobalAIName (Null or Empty)");
        Debug.Assert(string.IsNullOrEmpty(tagGlobalDrug) == false, "Invalid tagGlobalDrug (Null or Empty)");
        //main
        int num;

        GlobalMeta[] arrayOfGlobalMeta = GameManager.i.loadScript.arrayOfGlobalMeta;
        num = arrayOfGlobalMeta.Length;
        if (num > 0)
        {
            for (int i = 0; i < num; i++)
            {
                GlobalMeta assetSO = arrayOfGlobalMeta[i];
                //pick out and assign the ones required for fast acess, ignore the rest.
                //Also dynamically assign GlobalMeta.level values (0/1/2).
                switch (assetSO.name)
                {
                case "Local":
                    metaBottom    = assetSO;
                    assetSO.level = 0;
                    break;

                case "State":
                    metaMiddle    = assetSO;
                    assetSO.level = 1;
                    break;

                case "National":
                    metaTop       = assetSO;
                    assetSO.level = 2;
                    break;

                default:
                    Debug.LogWarningFormat("Invalid meta \"{0}\"", assetSO.name);
                    break;
                }
            }
            //error check
            if (metaBottom == null)
            {
                Debug.LogError("Invalid metaBottom (Null)");
            }
            if (metaMiddle == null)
            {
                Debug.LogError("Invalid metaMiddle (Null)");
            }
            if (metaTop == null)
            {
                Debug.LogError("Invalid metaTop (Null)");
            }
        }
        //
        // - - - GlobalChance - - -
        //
        GlobalChance[] arrayOfGlobalChance = GameManager.i.loadScript.arrayOfGlobalChance;
        num = arrayOfGlobalChance.Length;
        if (num > 0)
        {
            for (int i = 0; i < num; i++)
            {
                GlobalChance assetSO = arrayOfGlobalChance[i];
                //pick out and assign the ones required for fast acess, ignore the rest.
                //Also dynamically assign GlobalChance.level values (0/1/2).
                switch (assetSO.name)
                {
                case "Low":
                    chanceLow     = assetSO;
                    assetSO.level = 0;
                    break;

                case "Medium":
                    chanceMedium  = assetSO;
                    assetSO.level = 1;
                    break;

                case "High":
                    chanceHigh    = assetSO;
                    assetSO.level = 2;
                    break;

                case "Extreme":
                    chanceExtreme = assetSO;
                    assetSO.level = 3;
                    break;

                default:
                    Debug.LogWarningFormat("Invalid chance \"{0}\"", assetSO.name);
                    break;
                }
            }
            //error check
            if (chanceLow == null)
            {
                Debug.LogError("Invalid chanceLow (Null)");
            }
            if (chanceMedium == null)
            {
                Debug.LogError("Invalid chanceMedium (Null)");
            }
            if (chanceHigh == null)
            {
                Debug.LogError("Invalid chanceHigh (Null)");
            }
            if (chanceExtreme == null)
            {
                Debug.LogError("Invalid chanceCritical (Null)");
            }
        }
        //
        // - - - GlobalWho - - -
        //
        GlobalWho[] arrayOfGlobalWho = GameManager.i.loadScript.arrayOfGlobalWho;
        num = arrayOfGlobalWho.Length;
        if (num > 0)
        {
            for (int i = 0; i < num; i++)
            {
                GlobalWho assetSO = arrayOfGlobalWho[i];
                //pick out and assign the ones required for fast acess, ignore the rest.
                //Also dynamically assign GlobalWho.level values (0/1/2).
                switch (assetSO.name)
                {
                case "Player":
                    whoPlayer     = assetSO;
                    assetSO.level = 0;
                    break;

                case "Actor":
                    whoActor      = assetSO;
                    assetSO.level = 1;
                    break;

                default:
                    Debug.LogWarningFormat("Invalid GlobalWho \"{0}\"", assetSO.name);
                    break;
                }
            }
            //error check
            if (whoPlayer == null)
            {
                Debug.LogError("Invalid whoPlayer (Null)");
            }
            if (whoActor == null)
            {
                Debug.LogError("Invalid whoActor (Null)");
            }
        }
        //
        // - - - GlobalType - - -
        //
        GlobalType[] arrayOfGlobalType = GameManager.i.loadScript.arrayOfGlobalType;
        num = arrayOfGlobalType.Length;
        if (num > 0)
        {
            for (int i = 0; i < num; i++)
            {
                GlobalType assetSO = arrayOfGlobalType[i];
                //pick out and assign the ones required for fast acess, ignore the rest.
                //Also dynamically assign GlobalType.level values (0/1/2).
                switch (assetSO.name)
                {
                case "Bad":
                    typeBad       = assetSO;
                    assetSO.level = 0;
                    break;

                case "Neutral":
                    typeNeutral   = assetSO;
                    assetSO.level = 1;
                    break;

                case "Good":
                    typeGood      = assetSO;
                    assetSO.level = 2;
                    break;

                default:
                    Debug.LogWarningFormat("Invalid type \"{0}\"", assetSO.name);
                    break;
                }
            }
            //error check
            if (typeBad == null)
            {
                Debug.LogError("Invalid typeBad (Null)");
            }
            if (typeNeutral == null)
            {
                Debug.LogError("Invalid typeNeutral (Null)");
            }
            if (typeGood == null)
            {
                Debug.LogError("Invalid typeGood (Null)");
            }
        }
        //
        // - - - GlobalSide - - -
        //
        GlobalSide[] arrayOfGlobalSide = GameManager.i.loadScript.arrayOfGlobalSide;
        num = arrayOfGlobalSide.Length;
        if (num > 0)
        {
            for (int i = 0; i < num; i++)
            {
                GlobalSide assetSO = arrayOfGlobalSide[i];
                //pick out and assign the ones required for fast acess, ignore the rest.
                //Also dynamically assign GlobalSide.level values (0/1/2).
                switch (assetSO.name)
                {
                case "AI":
                    sideAI        = assetSO;
                    assetSO.level = 0;
                    break;

                case "Authority":
                    sideAuthority = assetSO;
                    assetSO.level = 1;
                    break;

                case "Resistance":
                    sideResistance = assetSO;
                    assetSO.level  = 2;
                    break;

                case "Both":
                    sideBoth      = assetSO;
                    assetSO.level = 3;
                    break;

                default:
                    Debug.LogWarningFormat("Invalid side \"{0}\"", assetSO.name);
                    break;
                }
            }
            //error check
            Debug.Assert(sideAI != null, "Invalid sideAI (Null)");
            Debug.Assert(sideAuthority != null, "Invalid sideAuthority (Null)");
            Debug.Assert(sideResistance != null, "Invalid sideResistance (Null)");
            Debug.Assert(sideBoth != null, "Invalid sideBoth (Null)");
        }
        NodeDatapoint[] arrayOfNodeDatapoints = GameManager.i.loadScript.arrayOfNodeDatapoints;
        num = arrayOfNodeDatapoints.Length;
        if (num > 0)
        {
            for (int i = 0; i < num; i++)
            {
                NodeDatapoint assetSO = arrayOfNodeDatapoints[i];
                //pick out and assign the ones required for fast acess, ignore the rest.
                //Also dynamically assign NodeDatapoint.level values (0/1/2).
                switch (assetSO.name)
                {
                case "Stability":
                    nodeStability = assetSO;
                    assetSO.level = 0;
                    break;

                case "Support":
                    nodeSupport   = assetSO;
                    assetSO.level = 1;
                    break;

                case "Security":
                    nodeSecurity  = assetSO;
                    assetSO.level = 2;
                    break;

                default:
                    Debug.LogWarningFormat("Invalid NodeDatapoint \"{0}\"", assetSO.name);
                    break;
                }
            }
            //error check
            Debug.Assert(nodeStability != null, "Invalid nodeStability (Null)");
            Debug.Assert(nodeSupport != null, "Invalid nodeSupport (Null)");
            Debug.Assert(nodeSecurity != null, "Invalid nodeSecurity (Null)");
        }
        //
        // - - - Trait Categories - - -
        //
        categoryActor = GameManager.i.dataScript.GetTraitCategory("Actor");
        categoryMayor = GameManager.i.dataScript.GetTraitCategory("Mayor");
        Debug.Assert(categoryActor != null, "Invalid categoryActor");
        Debug.Assert(categoryMayor != null, "Invalid categoryMayor");
    }