public SingleObjectModel CreateObjectPosting(string objectUID,
                                                     [FromBody] object body)
        {
            try {
                base.RequireBody(body);

                var bodyAsJson = JsonObject.Parse(body);

                var posting = new ObjectPosting(objectUID, bodyAsJson);

                posting.Save();

                if (!posting.SendTo.IsEmptyInstance)
                {
                    var activity = Activity.Parse(objectUID);

                    EventsNotifier.SendNotification(activity, posting.SendTo, posting.Title, posting.Body);
                }

                return(new SingleObjectModel(this.Request, posting.ToResponse(),
                                             typeof(ObjectPosting).FullName));
            } catch (Exception e) {
                throw base.CreateHttpException(e);
            }
        }
Beispiel #2
0
        // Use this for initialization
        //void Start()
        public BuildingsManager()
        {
            //player = GetComponent<Player>();
            //inputs = etComponent<UserInput>();
            grid   = GameObject.FindWithTag("GameController").GetComponent <ConstructionGrid>();
            cursor = CursorManager.Instance;
            // alpha components for the colors
            red.a   = 0.5f;
            green.a = 0.5f;
            InitBuildingStruct();

            notifier = GameObject.FindWithTag("GameController").GetComponent <EventsNotifier>();
        }
Beispiel #3
0
        // Use this for initialization
        //void Start()
        public BuildingsManager()
        {
            //player = GetComponent<Player>();
            //inputs = etComponent<UserInput>();
            grid = GameObject.FindWithTag("GameController").GetComponent<ConstructionGrid>();
            cursor = CursorManager.Instance;
            // alpha components for the colors
            red.a = 0.5f;
            green.a = 0.5f;
            InitBuildingStruct();

            notifier = GameObject.FindWithTag("GameController").GetComponent<EventsNotifier>();

        }
Beispiel #4
0
        public void Assign(JsonObject data)
        {
            if (!data.Contains("responsibleUID"))
            {
                return;
            }

            this.Responsible = data.Get <Contact>("responsibleUID", this.Responsible);

            if (!this.Responsible.IsEmptyInstance)
            {
                this.AssignedDate = DateTime.Now;
                this.AssignedBy   = EmpiriaUser.Current.AsContact();

                EventsNotifier.ActivityAssigned(this);
            }
            else
            {
                this.AssignedDate = ExecutionServer.DateMaxValue;
                this.AssignedBy   = Contact.Empty;
            }
        }
Beispiel #5
0
    // Use this for initialization
    public override void Start()
    {
        base.Start();
        _selection = GetComponent<Managers.SelectionManager>();
        //request the race of the player
        _selfRace = info.GetPlayerRace();
        _selection.SetRace(race);

        cam = GameObject.FindWithTag("MainCamera").GetComponent<CameraController>();
        events = GetComponent<EventsNotifier>();

        Battle.PlayerInformation me = info.GetBattle().GetPlayerInformationList()[playerId - 1];
        InstantiateBuildings(me.GetBuildings());
        InstantiateUnits(me.GetUnits());
        SetInitialResources(me.GetResources().Wood, me.GetResources().Food, me.GetResources().Metal, me.GetResources().Gold);
        // gameObject.AddComponent<ResourcesPlacer>();
        
        missionStatus = new MissionStatus(playerId);
        _resourcesPlacer = ResourcesPlacer.get(this); // initialization

        // TODO Set this values dynamically
        minFoodTolerance = 100;
        minWoodTolerance = 500;
        minMetalTolerance = 500;
        minGoldTolerance = 500;

        foodDepleted = _resourcesPlacer.Amount(WorldResources.Type.FOOD) <= 0;

        ActorSelector selector = new ActorSelector()
        {
            registerCondition = (g) => !(g.GetComponent<FOWEntity>().IsOwnedByPlayer),
            fireCondition = (g) => true
        };
        Utils.Subscriber<FOWEntity.Actions, FOWEntity>.get.registerForAll(FOWEntity.Actions.DISCOVERED, OnEntityFound, selector);

        timeToShow = WAIT_FOR_FINISH;

    }
Beispiel #6
0
    // Use this for initialization
    public override void Start()
    {
        base.Start();
        _selection = GetComponent <Managers.SelectionManager>();
        //request the race of the player
        _selfRace = info.GetPlayerRace();
        _selection.SetRace(race);

        cam    = GameObject.FindWithTag("MainCamera").GetComponent <CameraController>();
        events = GetComponent <EventsNotifier>();

        Battle.PlayerInformation me = info.GetBattle().GetPlayerInformationList()[playerId - 1];
        InstantiateBuildings(me.GetBuildings());
        InstantiateUnits(me.GetUnits());
        SetInitialResources(me.GetResources().Wood, me.GetResources().Food, me.GetResources().Metal, me.GetResources().Gold);
        // gameObject.AddComponent<ResourcesPlacer>();

        missionStatus    = new MissionStatus(playerId);
        _resourcesPlacer = ResourcesPlacer.get(this); // initialization

        // TODO Set this values dynamically
        minFoodTolerance  = 100;
        minWoodTolerance  = 500;
        minMetalTolerance = 500;
        minGoldTolerance  = 500;

        foodDepleted = _resourcesPlacer.Amount(WorldResources.Type.FOOD) <= 0;

        ActorSelector selector = new ActorSelector()
        {
            registerCondition = (g) => !(g.GetComponent <FOWEntity>().IsOwnedByPlayer),
            fireCondition     = (g) => true
        };

        Utils.Subscriber <FOWEntity.Actions, FOWEntity> .get.registerForAll(FOWEntity.Actions.DISCOVERED, OnEntityFound, selector);

        timeToShow = WAIT_FOR_FINISH;
    }
        public SingleObjectModel UpdateActivity(string projectUID, string activityUID,
                                                [FromBody] object body)
        {
            try {
                base.RequireBody(body);
                var bodyAsJson = JsonObject.Parse(body);

                var project = Project.Parse(projectUID);

                Activity activity = project.GetActivity(activityUID);

                activity.Update(bodyAsJson);

                if (!activity.ReminderData.IsEmptyInstance)
                {
                    EventsNotifier.RemindActivity(activity, activity.ReminderData);
                }

                return(new SingleObjectModel(this.Request, activity.ToResponse(),
                                             typeof(Activity).FullName));
            } catch (Exception e) {
                throw base.CreateHttpException(e);
            }
        }