Example #1
0
        /// <inheritdoc/>
        protected override void Dispose(bool disposing, bool disposeData)
        {
            if (!IsDisposed)
            {
                if (disposing)
                {
                    OcclusionQuery.SafeDispose();
                    OcclusionQuery = null;
                    SunOcclusion   = 0;

                    if (disposeData)
                    {
                        CloudMap.SafeDispose();
                    }
                }

                base.Dispose(disposing, disposeData);
            }
        }
Example #2
0
        private void DrawImportRow(int i, CloudMap cloudMap)
        {
            string uniqueId = i.ToString();

            ImGui.Text($"{cloudMap.Name}"); ImGui.NextColumn();
            ImGui.Text($"{cloudMap.Location}"); ImGui.NextColumn();
            ImGui.Text($"{cloudMap.Size}"); ImGui.NextColumn();
            ImGui.Text($"{cloudMap.Tags}"); ImGui.NextColumn();
            if (ImGui.Button(_localizer.Localize("Import") + "##" + uniqueId))
            {
                PluginLog.Log(cloudMap.Hash);
                Task <string> cloudItems = HttpPost.GetItems(Config.DefaultCloudUri, cloudMap.Hash);
                cloudItems.ContinueWith((t) => {
                    string str = t.Result;
                    //Plugin.Log(str);
                    try
                    {
                        Config.HousingItemList = JsonConvert.DeserializeObject <List <HousingItem> >(str);
                        foreach (var item in Config.HousingItemList)
                        {
                            try
                            {
                                item.Name = Plugin.Interface.Data.GetExcelSheet <Item>().GetRow(item.ItemKey).Name;
                            }
                            catch (Exception e)
                            {
                                Plugin.LogError($"Error while translating item#{item.ItemKey}: {e.Message}");
                            }
                        }
                        Config.ResetRecord();
                        Plugin.Log(String.Format(_localizer.Localize("Imported {0} items from Cloud."), Config.HousingItemList.Count));
                    }
                    catch (Exception e)
                    {
                        Plugin.LogError($"Error while importing items: {e.Message}");
                        LoadChocoboSave(str);
                    }
                });
            }
            ImGui.NextColumn();
        }
Example #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CloudLayerNode" /> class.
        /// </summary>
        /// <param name="cloudMap">The cloud map.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="cloudMap"/> is <see langword="null"/>.
        /// </exception>
        public CloudLayerNode(CloudMap cloudMap)
        {
            if (cloudMap == null)
            {
                throw new ArgumentNullException("cloudMap");
            }

            _cloudMap              = cloudMap;
            SkyCurvature           = 0.9f;
            TextureMatrix          = Matrix.Identity;
            SunDirection           = new Vector3(1, 1, 1);
            SunLight               = new Vector3(0.6f);
            AmbientLight           = new Vector3(0.8f);
            NumberOfSamples        = 8;
            SampleDistance         = 0.004f;
            ForwardScatterExponent = 5;
            ForwardScatterScale    = 1;
            ForwardScatterOffset   = 0.5f;
            HorizonFade            = 0.05f;
            Alpha        = 1;
            SunQuerySize = 0.05f;
        }
        private void DrawImportRow(int i, CloudMap cloudMap)
        {
            string uniqueId = i.ToString();

            ImGui.Text($"{cloudMap.Name}"); ImGui.NextColumn();
            var territoryName = Plugin.Interface.Data.GetExcelSheet <TerritoryType>().GetRow((uint)cloudMap.LocationId)?.PlaceName?.Value.Name;

            ImGui.Text(territoryName ?? _localizer.Localize("Unknown")); ImGui.NextColumn();
            ImGui.Text($"{cloudMap.Tags}"); ImGui.NextColumn();
            if (ImGui.Button(_localizer.Localize("Import") + "##" + uniqueId))
            {
                Config.LocationId = cloudMap.LocationId;
                PluginLog.Log(cloudMap.Hash);
                if (cloudMap.Hash != "")
                {
                    Task <string> cloudItems = HttpPost.GetItems(Config.DefaultCloudUri, cloudMap.Hash);
                    cloudItems.ContinueWith((t) => {
                        string str = t.Result;
                        //Plugin.Log(str);
                        try
                        {
                            Config.HousingItemList = JsonConvert.DeserializeObject <List <HousingItem> >(str);
                            Plugin.TranslateFurnitureList(ref Config.HousingItemList);
                            Config.ResetRecord();
                            Plugin.Log(String.Format(_localizer.Localize("Imported {0} items from Cloud."), Config.HousingItemList.Count));
                        }
                        catch (Exception e)
                        {
                            Plugin.LogError($"Error while importing items: {e.Message}", e.ToString());
                            LoadChocoboSave(str);
                        }
                    });
                }

                /*
                 * if (cloudMap.ObjectId != "")
                 * {
                 *  Task<string> cloudItems = HttpPost.GetItemsWithLeanCloud(Config.API_BASE_URL + Config.CLASS_NAME, cloudMap.ObjectId);
                 *  cloudItems.ContinueWith((t) => {
                 *      string str = JObject.Parse(t.Result)["Items"].ToString();
                 *      //Plugin.Log(str);
                 *      try
                 *      {
                 *          Config.HousingItemList = JsonConvert.DeserializeObject<List<HousingItem>>(str);
                 *          foreach (var item in Config.HousingItemList)
                 *          {
                 *              try
                 *              {
                 *                  item.Name = Plugin.Interface.Data.GetExcelSheet<Item>().GetRow(item.ItemKey).Name;
                 *              }
                 *              catch (Exception e)
                 *              {
                 *                  Plugin.LogError($"Error while translating item#{item.ItemKey}: {e.Message}");
                 *              }
                 *          }
                 *          Config.ResetRecord();
                 *          Plugin.Log(String.Format(_localizer.Localize("Imported {0} items from LeanCloud."), Config.HousingItemList.Count));
                 *      }
                 *      catch (Exception e)
                 *      {
                 *          Plugin.LogError($"Error while importing items: {e.Message}");
                 *          LoadChocoboSave(str);
                 *      }
                 *  });
                 * }
                 */
            }
            ImGui.NextColumn();
        }
Example #5
0
        //--------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="CloudLayerNode" /> class.
        /// </summary>
        /// <param name="cloudMap">The cloud map.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="cloudMap"/> is <see langword="null"/>.
        /// </exception>
        public CloudLayerNode(CloudMap cloudMap)
        {
            if (cloudMap == null)
            throw new ArgumentNullException("cloudMap");

              _cloudMap = cloudMap;
              SkyCurvature = 0.9f;
              TextureMatrix = Matrix33F.Identity;
              SunDirection = new Vector3F(1, 1, 1);
              SunLight = new Vector3F(0.6f);
              AmbientLight = new Vector3F(0.8f);
              NumberOfSamples = 8;
              SampleDistance = 0.004f;
              ForwardScatterExponent = 5;
              ForwardScatterScale = 1;
              ForwardScatterOffset = 0.5f;
              HorizonFade = 0.05f;
              Alpha = 1;
              SunQuerySize = 0.05f;
        }