Ejemplo n.º 1
0
 // Start is called before the first frame update
 void Start()
 {
     _errorGui          = gameHandler.GetComponent <ErrorGui>();
     _gameTimeHandler   = gameHandler.GetComponent <GameTimeHandler>();
     _economics         = gameHandler.GetComponent <Economics>();
     _dataBaseConnector = gameHandler.GetComponent <DataBaseConnector>();
     Debug.Log("GameEventHandler.Start");
 }
        /// <summary>
        /// Serializes the specified serializer.
        /// </summary>
        /// <param name="serializer">The serializer.</param>
        /// <returns>
        /// A serialized <see cref="IDictionary{String,Object}" />.
        /// </returns>
        public IDictionary <string, object> Serialize(JavaScriptSerializer serializer)
        {
            IDictionary <string, object> serialized = new Dictionary <string, object>();

            serialized["customFields"]     = CustomFields;
            serialized["economics"]        = Economics.ToBrightcoveName();
            serialized["itemState"]        = ItemState.ToBrightcoveName();
            serialized["linkURL"]          = LinkUrl;
            serialized["linkText"]         = LinkText;
            serialized["longDescription"]  = LongDescription;
            serialized["name"]             = Name;
            serialized["referenceId"]      = ReferenceId;
            serialized["shortDescription"] = ShortDescription;
            serialized["tags"]             = Tags;

            // if the date is MinValue, that means it hasn't been set, so don't include it
            if (StartDate > DateTime.MinValue)
            {
                serialized["startDate"] = StartDate.ToUnixMillisecondsUtc();
            }
            if (EndDate > DateTime.MinValue)
            {
                serialized["endDate"] = EndDate.ToUnixMillisecondsUtc();
            }

            // When creating or updating a video, only one of either VideoFullLength and Renditions may
            // be set. If both are set, we get the following error:
            // "IllegalValueError - videoFullLength and renditions are mutually exclusive; you must set one or the other. (code 304)"
            // To prevent this exception, only submit Renditions if both are set

            // Additionally, Renditions may only be updated through the Media API in cases where they use a remote asset.
            // Don't submit renditions that lack a RemoteUrl, or the API will return an error.
            if (Renditions.Count > 0)
            {
                serialized["renditions"] = Renditions.Where(r => !String.IsNullOrEmpty(r.RemoteUrl));
            }
            else if (VideoFullLength != null && !String.IsNullOrEmpty(VideoFullLength.RemoteUrl))
            {
                serialized["videoFullLength"] = VideoFullLength;
            }
            if (IOSRenditions.Count > 0)
            {
                serialized["IOSRenditions"] = IOSRenditions.Where(r => !String.IsNullOrEmpty(r.RemoteUrl));
            }

            if (CuePoints.Count > 0)
            {
                serialized["cuePoints"] = CuePoints;
            }

            // The Id must be non-0.
            if (Id != 0)
            {
                serialized["id"] = Id;
            }

            return(serialized);
        }
Ejemplo n.º 3
0
        protected override void Loaded(Harmony harmony)
        {
            Economics = new Economics()
            {
                Automation = this
            };

            Lib = GetDependency <Lib.Lib>("Lib");
        }
Ejemplo n.º 4
0
        public void AddEconomicsRecord(Economics economics)
        {
            EconomicsRecord er = new EconomicsRecord();

            er.data = economics;
            if (map.ContainsKey("jtjjqkrecord"))
            {
                map["jtjjqkrecord"] = er;
            }
            else
            {
                map.Add("jtjjqkrecord", er);
            }
        }
Ejemplo n.º 5
0
        private void OnButtonClick(object sender, EventArgs e)
        {
            LogInfo($"You've clicked a time increment button and opened the eco window");

            Lib.UIManager.RunOnForm(AuroraType.EconomicsForm, form =>
            {
                foreach (var c in UIManager.IterateControls(form))
                {
                    LogInfo($"Control type {c.GetType().Name} name {c.Name}");
                }
            });

            Economics.CreateConstructionProject("Earth", "Components", "Diplomacy Module", 3, 40);
        }
Ejemplo n.º 6
0
        private void Awake()
        {
            if (instance == null)
            {
                instance = this;
            }
            else if (instance != this)
            {
                Destroy(gameObject);
            }
            DontDestroyOnLoad(gameObject);

            _states    = new IState[2];
            _states[0] = new Deploy();
            _states[1] = new Economics();

            FleetDisplayArea.OnShipInfoDragged   += ShipInfo_Dragged;
            FleetDisplayArea.OnShipInfoDragEnd   += ShipInfo_DragEnd;
            FleetDisplayArea.OnFleetDisplayEmpty += FleetDisplayArea_Empty;
            FleetDisplayArea.OnFleetSelected     += FleetDisplayArea_FleetSelected;

            HexGrid.OnHexEntered += HexGrid_HexEntered;
            HexGrid.OnHexExited  += HexGrid_HexExited;
            HexGrid.OnHexSelect  += PopulateHexContents;

            DataStore.DataStore store = new DataStore.DataStore();
            _mapData = store.GetMapData();
            //_shipClasses = store.GetShipClasses();
            CurrentTurn    = 136;
            _activeFaction = _mapData.GetFaction(Factions.Lyran);
            PopulateProvinceNodes();
            PopulateVisualNodes();
            HexGrid.PopulateVisualData(_visualNodes, _provinceList);

            _currentState       = _states[0];
            PhaseButton.enabled = false;

            /*_disabledCursorTexture = new Texture2D((int)DisabledCursorSprite.textureRect.width, (int)DisabledCursorSprite.textureRect.height);
             * var pixels = DisabledCursorSprite.texture.GetPixels((int)DisabledCursorSprite.textureRect.x,
             *                                      (int)DisabledCursorSprite.textureRect.y,
             *                                      (int)DisabledCursorSprite.textureRect.width,
             *                                      (int)DisabledCursorSprite.textureRect.height);
             * _disabledCursorTexture.SetPixels(pixels);
             * _disabledCursorTexture.Resize(32, 32);
             * _disabledCursorTexture.Apply();*/
        }