public IHttpActionResult PostCustomText(CustomText customText)
        {
            CustomTextService customTextService = new CustomTextService();

            customTextService.UpsertCustomText(customText, db);

            return(CreatedAtRoute("DefaultApi", new { id = customText.TextId }, customText));
        }
        public IHttpActionResult GetCustomText(int id)
        {
            CustomTextService customTextservice = new CustomTextService();

            List <CustomText> customTextByPageId = new List <CustomText>();

            var content = customTextservice.getImagesAndText(db, dbImage, id);

            //customTextByPageId = customTextservice.GetTextByPageId(id, db, customTextByPageId);

            return(Ok(content));
        }
Beispiel #3
0
    void Serialize(string SearchingStartDirectory)
    {
        ItemDatabase.ItemPath[] foundItemPaths = findItemPaths(SearchingStartDirectory);

        ItemDatabase.ItemPathSerial ips = new ItemDatabase.ItemPathSerial();
        ips.data = foundItemPaths;

        string output = CustomTextService.SerializeJson(ips);

        //WriteJson(output, outputPath);
        CustomTextService.WriteJsonToDirectory(output, outputPath, "itempaths");
        Debug.Log(string.Format("[ITEM DB]: Build is a success. a total of {0} item paths found.", foundItemPaths.Length));
        AssetDatabase.Refresh();
    }
Beispiel #4
0
    /// <summary>
    /// Function used by the GameManager to initialize the client's item database.
    /// </summary>
    static void LoadItemDictionary()
    {
        ItemPathSerial itemDataCollection = new ItemPathSerial();

        try
        {
            string itemPathJson = CustomTextService.ReadJsonFromResources("JsonData/ItemPathData/itempaths"); //Take all of the item's filepath json file and convert to string
            itemDataCollection = CustomTextService.DeSerializeJson <ItemPathSerial>(itemPathJson);            //DeSerialize the json
        }
        catch (Exception e)
        {
            Debug.LogError(e.ToString());
        }

        ItemList = new Dictionary <string, ItemBase>(); // Initialize the ItemDatabase Dictionary
        foreach (ItemPath item in itemDataCollection.data)
        {
            ItemBase itembs = (Resources.Load(item.resourcesPath) as GameObject).GetComponent <ItemBase>(); //as simple as it gets
            ItemList.Add(item.itemIdentifier, itembs);
        }
        DebugConsole.LogDev(string.Format("Item Database was succesfully loaded with {0} total items.", ItemList.Count));
    }