Exemple #1
0
        public async UniTask <string> LoadAsyncAsRawString()
        {
            if (ParamValidate() is false)
            {
                return(null);
            }

            var spreadSheetJson = await DownloadSpreadSheet();

            if (spreadSheetJson is null)
            {
                return(null);
            }

            var response = ParseSpreadSheetJson(spreadSheetJson);

            if (response is null)
            {
                return(null);
            }

            var result = ParseResponseAsRawCsvString(response);

            PostLoad?.Invoke();
            return(result);
        }
Exemple #2
0
        /// <inheritdoc />
        public void Load()
        {
            PreLoad?.Invoke(this, new LoadEventArgs(Assets));

            InternalLoad();

            PostLoad?.Invoke(this, new LoadEventArgs(Assets));
        }
        private void ReceiveItemMessage(object sender, MessageEventArgs e)
        {
            string   s       = Utils.DecompressData(e.RawData);
            PostLoad request = JsonConvert.DeserializeObject <PostLoad>(s);

            if (IsDisplayable(request))
            {
                NotificationManager.Notifier.ShowItem(request);
            }
        }
Exemple #4
0
        /// <inheritdoc />
        public void Load()
        {
            PreLoad?.Invoke(this, new LoadEventArgs(this.Assets));

            foreach (Cursor mouseCursor in Cursor.All)
            {
                mouseCursor.Load(Assets);
            }

            PostLoad?.Invoke(this, new LoadEventArgs(this.Assets));
        }
Exemple #5
0
        internal void PostGameLoad()
        {
            _pathfindingManager = new PathfindingManager(this);

            // Invoke the Post Load event down the chain.
            PostLoad?.Invoke(this, EventArgs.Empty);

            // set isLoaded to true:
            IsLoaded = true;

            // Post load event completed. Drop all handlers.
            PostLoad = null;
        }
        public ItemNotification(PostLoad postLoad)
        {
            PostLoad = postLoad;

            OnlineIconUrl = Path.Combine(Functions.PathToTemp(), Path.GetFileName(FNA.GetFilePair(postLoad.Item.UrlName).FileName));

            FullName = _postLoad.Item.Name;

            UrlName = _postLoad.Item.UrlName;

            Quantity += $"[{postLoad.Quantity}]";

            OfferText = $"{postLoad.Platinum} Platinum";

            if (postLoad.Quantity > 1)
            {
                OfferText += $" Each ({postLoad.Quantity * postLoad.Platinum})";
            }

            switch (_postLoad.Type)
            {
            case OrderType.Buy:
                OfferForeground = Constants.WtbForeground;
                OfferBackground = Constants.WtbBackground;
                break;

            case OrderType.Sell:
                OfferForeground = Constants.WtsForeground;
                OfferBackground = Constants.WtsBackground;
                break;
            }

            switch (_postLoad.User.Status)
            {
            case Status.Ingame:
                UserStatus       = "ONLINE IN GAME";
                StatusForeground = Constants.StatusForegroundIngame;
                break;

            case Status.Offline:
                UserStatus       = "OFFLINE";
                StatusForeground = Constants.StatusForegroundOffline;
                break;

            case Status.Online:
                UserStatus       = "ONLINE";
                StatusForeground = Constants.StatusForegroundOnline;
                break;
            }
        }
Exemple #7
0
        /// <inheritdoc />
        public void Load()
        {
            PreLoad?.Invoke(this, new LoadEventArgs(Assets));

            foreach (Dialog dialog in Dialogs)
            {
                dialog.Load();
            }

            foreach (Window window in Windows)
            {
                window.Load();
            }

            Mouse.Load();

            PostLoad?.Invoke(this, new LoadEventArgs(Assets));
        }
        public void Load(NodeGraphData graphData)
        {
            NodeEditor.Logger.Log <NodeGraph>("Initializing...");

            Unload();

            NodeEditor.Logger.Log <NodeGraph>("Reading from graph data...");

            if (string.IsNullOrEmpty(graphData.GraphType))
            {
                NodeEditor.Logger.LogWarning <NodeGraph>("Loading graph with no graph type. Defaulting...");
                GraphType = _defaultGraphType;
            }
            else
            {
                var type = Type.GetType(graphData.GraphType);

                NodeEditor.Assertions.IsNotNull(type, "Invalid graph type.");

                if (type != null)
                {
                    GraphType = Activator.CreateInstance(type) as NodeGraphType;
                    NodeEditor.Logger.Log <NodeGraph>("Graph type set to '{0}'", GraphType.GetType().ToString());
                }
                else
                {
                    GraphType = _defaultGraphType;
                    NodeEditor.Logger.Log <NodeGraph>("Graph type invalid. Setting to default.");
                }
            }

            graphData.Variables.ForEach(variable => AddVariable(variable));
            graphData.Nodes.ForEach(x => AddNode(x));
            graphData.Constants.ForEach(x => AddNodeConstant(x));
            graphData.VariableNodes.ForEach(x => AddNodeVariable(x));
            graphData.Connections.ForEach(connectionData => Connect(connectionData));

            if (PostLoad != null)
            {
                PostLoad.Invoke(this, graphData);
            }
        }
Exemple #9
0
 static void Load(SaveFile saveFile)
 {
     Migrations.Migrate(saveFile);
     PreLoad?.Invoke();
     GameTime.save = saveFile.gameTime;
     CurrencySystem.instance.save           = saveFile.currency;
     ConveyorSystem.instance.save           = saveFile.conveyor;
     MachineSystem.instance.save            = saveFile.machine;
     TileSelectionManager.instance.save     = saveFile.tileSelection;
     OverviewCameraController.instance.save = saveFile.overviewCameraController;
     Analytics.instance.save = saveFile.analytics;
     BackgroundMusic.instance.SetSave(in saveFile.backgroundMusic);
     InterfaceSelectionManager.instance.SetSave(in saveFile.interfaceSelection);
     MachineGroupAchievements.instance.SetSave(in saveFile.machineGroupAchievements);
     MachineUnlockSystem.instance.SetSave(in saveFile.machineUnlocks);
     ProgressionStore.instance.SetSave(in saveFile.progressionSystem);
     SpacePlatform.SetSave(in saveFile.spacePlatforms);
     PostLoad?.Invoke();
     LoadComplete?.Invoke();
 }
        /// <inheritdoc />
        public void Load()
        {
            PreLoad?.Invoke(this, new LoadEventArgs(Assets));

            this.background = this.Assets.CreateTexture2D(1, 1);
            background.SetData(new[] { Background });

            InternalLoad();

            if (!isWidthSet)
            {
                Width = DefaultWidth;
            }

            if (!isHeightSet)
            {
                Height = DefaultHeight;
            }

            this.IsLoaded = true;

            PostLoad?.Invoke(this, new LoadEventArgs(Assets));
        }
        private static bool IsDisplayable(PostLoad request)
        {
            // If the item offer is not from our region or platform, we don't care
            if (request.User.Platform != Global.Configuration.User.Platform || request.User.Region != Global.Configuration.User.Region)
            {
                return(false);
            }

            // Is the user account in a state that we want? (Ingame, Offline, Online)
            if (!Global.Configuration.User.UserStates.Contains(request.User.Status))
            {
                return(false);
            }

            //Do we have any enabled?
            var matcher = Global.Configuration.Items.Where(x => x.Enabled).ToArray();

            if (!matcher.Any())
            {
                return(false);
            }

            // Do we have a matching item? (Check the name)
            matcher = matcher.Where(x => x.UrlName == request.Item.UrlName).ToArray();
            if (!matcher.Any())
            {
                return(false);
            }

            // Do we have a matching type? (Buy or sell)
            matcher = matcher.Where(x => x.Type == request.Type).ToArray();
            if (!matcher.Any())
            {
                return(false);
            }

            // Do we have a matching price?
            matcher = matcher.Where(x =>
                                    (request.Platinum <= x.Price && x.Type == OrderType.Sell) || // (Equal to or cheaper than our buy offer)
                                    (request.Platinum >= x.Price && x.Type == OrderType.Buy))    // (Equal or better than our sell offer)
                      .ToArray();
            if (!matcher.Any())
            {
                return(false);
            }

            // Do we have a matching quantity? (More than our min, but less than our max)
            matcher = matcher.Where(x => request.Quantity >= x.QuantityMin && request.Quantity <= x.QuantityMax).ToArray();
            if (!matcher.Any())
            {
                return(false);
            }

            // Is this the sort of item that has ranks? If so, we need to compare ranks
            if (request.ModRank.HasValue)
            {
                // Do we have a matching rank? (More than our min, but less than our max)
                matcher = matcher.Where(x => request.ModRank.Value >= x.ModRankMin && request.ModRank.Value <= x.ModRankMax).ToArray();
                if (!matcher.Any())
                {
                    return(false);
                }
            }

            return(matcher.Any());
        }