示例#1
0
        public DB_SubCalendarEvent(CalendarEvent calendarEvent, TilerUser Creator, TilerUserGroup users, string timeZone, string MySubEventID, EventName name, BusyTimeLine MyBusylot, DateTimeOffset EventStart, DateTimeOffset EventDeadline, TimeSpan EventPrepTime, string myParentID, bool Rigid, bool Enabled, EventDisplay UiParam, MiscData Notes, bool completeFlag, TilerElements.Location EventLocation = null, TimeLine calendarEventRange = null, ConflictProfile conflicts = null)
        {
            if (EventDeadline < EventStart)
            {
                throw new Exception("SubCalendar Event cannot have an end time earlier than the start time");
            }
            _TimeZone = timeZone;
            _Name     = name;
            _Creator  = Creator;
            _Users    = users;
            if (conflicts == null)
            {
                conflicts = new ConflictProfile();
            }
            _ConflictingEvents  = conflicts;
            _CalendarEventRange = calendarEventRange;
            //string eventName, TimeSpan EventDuration, DateTimeOffset EventStart, DateTimeOffset EventDeadline, TimeSpan EventPrepTime, TimeSpan PreDeadline, bool EventRigidFlag, bool EventRepetition, int EventSplit
            updateStartTime(EventStart);
            updateEndTime(EventDeadline);
            _EventDuration     = MyBusylot.End - MyBusylot.Start;
            BusyFrame          = MyBusylot;
            _PrepTime          = EventPrepTime;
            UniqueID           = new EventID(MySubEventID);
            this._LocationInfo = EventLocation;

            _UiParams = UiParam;
            _DataBlob = Notes;
            _Complete = completeFlag;

            this._Enabled = Enabled;
            //EventSequence = new EventTimeLine(UniqueID.ToString(), StartDateTime, EndDateTime);
            _RigidSchedule = Rigid;
            _LastReasonStartTimeChanged = this.Start;
            _calendarEvent = calendarEvent;
        }
示例#2
0
 public static void ActionResponse(string SessionKey, EventDisplay targetEvent, string AttribId, string AttribValue, string targetActionCode, TraceLog t)
 {
     t.CreateLog("---START OF ACTION_RESPONSE---");
     try
     {
         using (var ServiceClientWS = new SelcommWSsvc.SelcommWSAll.ServiceClient(GetSelcommWsEndpointName()))
         {
             var serviceAttribute = new ServiceAttribute
             {
                 AttributeTemplate = new AttributeTemplate {
                     Id = Convert.ToInt64(AttribId)
                 },
                 Key   = targetEvent.ServiceId,
                 Value = AttribValue,
                 Event = new Event()
                 {
                     Id = targetEvent.EventId
                 }
             };
             t.CreateLog($"Creating service attribute for service id:{targetEvent.ServiceId}");
             ServiceClientWS.ServiceAttributeUpdate(SessionKey, serviceAttribute);
             t.CreateLog($"Service attribute for {targetActionCode} with Attribute ID: {serviceAttribute.AttributeTemplate.Id} and Attribute value: {AttribValue} created against service id {targetEvent.ServiceId}");
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#3
0
 // Called when script is destroyed
 void OnDestroy()
 {
     if (eventDisplay == this)
     {
         // when destroyed remove static reference to itself
         eventDisplay = null;
     }
 }
    private IEnumerator TriggerEventsInOrder(float startWaitTime, float loopWaitTime)
    {
        yield return(new WaitForSeconds(startWaitTime));

        while (true)
        {
            m_lastEvent = EventDisplay.FunctionTriggered(s_orderedEventList[m_eventCounter++ % s_orderedEventList.Count]);

            yield return(new WaitForSeconds(loopWaitTime));
        }
    }
示例#5
0
    // Begin called at start of action
    public override void Begin(NarrativeEvent newEvent)
    {
        base.Begin(newEvent);

        eventDisplay = EventDisplay.eventDisplay;
        musicManager = MusicManager.musicManager;

        eventDisplay.DisplayVictory(victory_);

        endTimer_ = new Timer();
        endTimer_.SetTimer(endTime_);

        Debug.Log("this is happening");
    }
示例#6
0
 // When object is created
 void Awake()
 {
     // Check if an eventDisplay already exists
     if (eventDisplay == null)
     {
         // If not set the static reference to this object
         eventDisplay = this;
     }
     else if (eventDisplay != this)
     {
         // Else a different eventDisplay already exists destroy this object
         Destroy(gameObject);
     }
 }
示例#7
0
        public void CreateDisplayMessage_EventoRecibido_CreaMensajeCorrecto()
        {
            IUtil           util         = new Util();
            MonthCalculator SUT          = new MonthCalculator(util);
            EventDisplay    eventDisplay = new EventDisplay();

            eventDisplay.cNombre     = "Test";
            eventDisplay.dtFecha     = new DateTime(2020, 2, 1);
            eventDisplay.iDiferencia = 50400;
            eventDisplay.Tipo        = RangeType.Month;

            var result = SUT.CreateDisplayMessage(eventDisplay);

            Assert.AreEqual("Test ocurrirá dentro de: 1 Mes", result);
        }
示例#8
0
        public EventDisplay getDisplayUINode(XmlNode Arg1)
        {
            XmlNode      var1        = Arg1.SelectSingleNode("UIParams");
            int          DefaultFlag = Convert.ToInt32(var1.SelectSingleNode("Type").InnerText);
            bool         DisplayFlag = Convert.ToBoolean(var1.SelectSingleNode("Visible").InnerText);
            EventDisplay retValue;
            TilerColor   colorNode = getColorNode(var1);

            if (DefaultFlag == 0)
            {
                retValue = new EventDisplay();
            }
            else
            {
                retValue = new EventDisplay(DisplayFlag, colorNode, DefaultFlag);
            }
            return(retValue);
        }
示例#9
0
        public List <EventDisplay> SetInfoEventsDisplay(List <Event> listEvents)
        {
            List <EventDisplay> listDisplay = new List <EventDisplay>();

            foreach (Event item in listEvents)
            {
                EventDisplay newEvent = new EventDisplay();
                newEvent.cNombre     = item.cNombre;
                newEvent.dtFecha     = item.dtFecha;
                newEvent.Tipo        = _determineType.CalculateType(item.dtFecha);
                newEvent.lPasado     = _validateDate.DeterminePastEvent(item.dtFecha);
                newEvent.iDiferencia = _validateDate.SetMinutes(item.dtFecha);
                ITypeCalculator typeCalculator = _determineTypeFactory.ObtenerInstancia(newEvent.Tipo);
                newEvent.cMensaje = typeCalculator.CreateDisplayMessage(newEvent);

                listDisplay.Add(newEvent);
            }
            return(listDisplay);
        }
示例#10
0
        /// <summary>
        /// this method loads the type of customer i.e B = Corporate and P=Consumer
        /// </summary>
        /// <returns></returns>
        public static string LoadCustomerType(string sessionKey, EventDisplay targetEvent)
        {
            using (var ContactClientWS = new SelcommWSsvc.SelcommWSAll.ContactClient(GetSelcommWsEndpointName()))
            {
                var ContactObj   = ContactClientWS.Contact(sessionKey, targetEvent.ContactCode, true, false, false, false);
                var customerType = ContactObj?.SubType?.Type;
                switch (customerType)
                {
                case "P":
                    customerType = "01";
                    break;

                case "B":
                    customerType = "02";
                    break;

                default:
                    throw new Exception("Customer Type does not contain value");
                }
                return(customerType);
            }
        }
示例#11
0
 /// <summary>
 /// This method is responsible for processing a single Event
 /// </summary>
 public abstract void ProcessEvent(EventDisplay targetEvent, TraceLog t);
示例#12
0
        public DB_CalendarEventFly(string EventIDData, string Name, DateTimeOffset StartData, DateTimeOffset EndData, int PriorityData, Repetition RepetitionData, Location_Elements LocationData, TimeSpan TImePerSplitData, DateTimeOffset OriginalStartData, TimeSpan EventPrepTimeData, TimeSpan Event_PreDeadlineData, bool EventRigidFlagData, int SplitData, EventDisplay UiData, MiscData NoteData, bool CompletionFlagData, long RepeatIndexData, Procrastination ProcrastinationData, NowProfile NowProfileData, int CompleteCountData, int DeletionCountData, List <string> AllUserIDs)
        {
            EventName                = Name;
            StartDateTime            = StartData;
            EndDateTime              = EndData;
            EventRepetition          = RepetitionData;
            LocationInfo             = LocationData;
            TimePerSplit             = TImePerSplitData;
            OriginalStart            = OriginalStartData;
            PrepTime                 = EventPrepTimeData;
            EventPreDeadline         = Event_PreDeadlineData;
            ProfileOfNow             = NowProfileData;
            RigidSchedule            = EventRigidFlagData;
            Complete                 = CompletionFlagData;
            CompletedCount           = CompleteCountData;
            DeletedCount             = DeletionCountData;
            ProfileOfProcrastination = ProcrastinationData;
            SubEvents                = new Dictionary <EventID, SubCalendarEvent>();
            Priority                 = PriorityData;
            isRestricted             = false;
            RepetitionSequence       = 0;
            Splits   = SplitData;
            UniqueID = new EventID(EventIDData);
            UserIDs  = AllUserIDs;

            if (EventRepetition.Enable)
            {
                EventRepetition.PopulateRepetitionParameters(this);
            }
            else
            {
                DateTimeOffset SubEventEndData   = EndData;
                DateTimeOffset SubEventStartData = SubEventEndData - TimePerSplit;
                int            i             = 0;
                int            SubEventCount = Splits - (CompletedCount + DeletedCount);
                for (int j = 0; j < SubEventCount; i++, j++)
                {
                    EventID          SubEventID     = EventID.GenerateSubCalendarEvent(UniqueID.ToString(), i + 1);
                    SubCalendarEvent newSubCalEvent = new DB_SubCalendarEventFly(SubEventID, Name, SubEventStartData, SubEventEndData, PriorityData, LocationInfo.CreateCopy(), OriginalStart, EventPrepTimeData, Event_PreDeadlineData, EventRigidFlagData, UiData.createCopy(), NoteData.createCopy(), Complete, ProcrastinationData, NowProfileData, this.RangeTimeLine, EventRepetition.Enable, false, true, AllUserIDs.ToList(), i);
                    SubEvents.Add(newSubCalEvent.SubEvent_ID, newSubCalEvent);
                }

                /*
                 * for (int j = 0; j < CompletedCount; i++, j++)
                 * {
                 *  EventID SubEventID = EventID.GenerateSubCalendarEvent(UniqueID.ToString(), i + 1);
                 *  SubCalendarEvent newSubCalEvent = new DB_SubCalendarEventFly(SubEventID, Name, SubEventStartData, SubEventEndData, PriorityData, LocationInfo.CreateCopy(), OriginalStart, EventPrepTimeData, Event_PreDeadlineData, EventRigidFlagData, UiData.createCopy(), NoteData.createCopy(), Complete, ProcrastinationData, NowProfileData, this.RangeTimeLine, EventRepetition.Enable, true, true, AllUserIDs.ToList(), 0);
                 *  SubEvents.Add(newSubCalEvent.SubEvent_ID, newSubCalEvent);
                 * }
                 *
                 * for (int j = 0; j < DeletedCount; i++, j++)
                 * {
                 *  EventID SubEventID = EventID.GenerateSubCalendarEvent(UniqueID.ToString(), i + 1);
                 *  SubCalendarEvent newSubCalEvent = new DB_SubCalendarEventFly(SubEventID, Name, SubEventStartData, SubEventEndData, PriorityData, LocationInfo.CreateCopy(), OriginalStart, EventPrepTimeData, Event_PreDeadlineData, EventRigidFlagData, UiData.createCopy(), NoteData.createCopy(), Complete, ProcrastinationData, NowProfileData, this.RangeTimeLine, EventRepetition.Enable, true, false, AllUserIDs.ToList(), 0);
                 *  SubEvents.Add(newSubCalEvent.SubEvent_ID, newSubCalEvent);
                 * }
                 */
            }
            UpdateLocationMatrix(myLocation);
        }
示例#13
0
 public DB_ProcrastinateCalendarEvent(EventID procrasstinaeAllId, EventName NameEntry, DateTimeOffset StartData, DateTimeOffset EndData, TimeSpan EventDuration, TimeSpan eventPrepTime, TimeSpan PreDeadlineTimeSpan, Repetition EventRepetitionEntry, TilerElements.Location EventLocation, EventDisplay UiData, MiscData NoteData, bool EnabledEventFlag, bool CompletionFlag, TilerUser creator, TilerUserGroup users, string timeZone, int splitCount, NowProfile nowProfile) : base(procrasstinaeAllId, NameEntry, StartData, EndData, EventDuration, eventPrepTime, PreDeadlineTimeSpan, EventRepetitionEntry, EventLocation, UiData, NoteData, EnabledEventFlag, CompletionFlag, creator, users, timeZone, splitCount, nowProfile)
 {
     UniqueID = procrasstinaeAllId;
 }
示例#14
0
 // GET api/event
 /// <summary>
 /// Gets a list of events
 /// </summary>
 /// <returns>
 /// List of events in JSON or XML format
 /// </returns>
 public List <EventDisplay> GetEvents()
 {
     return(EventDisplay.List());
 }
示例#15
0
 // GET api/event/5
 /// <summary>
 /// Gives details of single event
 /// </summary>
 /// <param name="id">
 /// The unique EventID
 /// </param>
 /// <returns>
 /// Event details in JSON or XML format
 /// </returns>
 public EventDisplay Get(int id)
 {
     return(EventDisplay.GetDetails(id));
 }
示例#16
0
 public string CreateDisplayMessage(EventDisplay eventDisplay)
 {
     return(string.Format("{0} {1}: {2} {3}", eventDisplay.cNombre, eventDisplay.lPasado ? cLeyendaPasado : cLeyendaFuturo, obtenerValor(eventDisplay.iDiferencia), _util.GetDisplayName(eventDisplay.Tipo)));
 }
示例#17
0
        static public CalendarEvent InstantiateRepeatedCandidate(EventID EventIDEntry, string EventName, TimeSpan Event_Duration, DateTimeOffset EventStart, DateTimeOffset EventDeadline, DateTimeOffset OriginalStartData, TimeSpan EventPrepTime, TimeSpan Event_PreDeadline, bool EventRigidFlag, Repetition EventRepetitionEntry, int EventSplit, Location_Elements EventLocation, bool enabledFlag, EventDisplay UiData, MiscData NoteData, bool CompletionFlag, long RepeatIndex, ConcurrentDictionary <DateTimeOffset, CalendarEvent> OrginalStartToCalendarEvent, CalendarEvent RepeatRootData)
        {
            DB_CalendarEventFly RetValue = new DB_CalendarEventFly();

            RetValue.EventName          = EventName;
            RetValue.StartDateTime      = EventStart;
            RetValue.EndDateTime        = EventDeadline;
            RetValue.EventDuration      = Event_Duration;
            RetValue.Enabled            = enabledFlag;
            RetValue.EventRepetition    = EventRepetitionEntry;
            RetValue.PrepTime           = EventPrepTime;
            RetValue.EventPreDeadline   = Event_PreDeadline;
            RetValue.RigidSchedule      = EventRigidFlag;
            RetValue.LocationInfo       = EventLocation;
            RetValue.UniqueID           = EventIDEntry;
            RetValue.UiParams           = UiData;
            RetValue.DataBlob           = NoteData;
            RetValue.Complete           = CompletionFlag;
            RetValue.RepetitionSequence = RepeatIndex;
            RetValue.OriginalStart      = OriginalStartData;
            RetValue.Splits             = EventSplit;
            RetValue.TimePerSplit       = TimeSpan.FromTicks(((RetValue.EventDuration.Ticks / RetValue.Splits)));
            RetValue.FromRepeatEvent    = true;

            /*
             * if (RetValue.EventRepetition.Enable)
             * {
             *  RetValue.Splits = EventSplit;
             *  RetValue.TimePerSplit = new TimeSpan();
             * }
             * else
             * {
             *  RetValue.Splits = EventSplit;
             * }
             */
            RetValue.SubEvents = new Dictionary <EventID, SubCalendarEvent>();

            if (!RetValue.EventRepetition.Enable)
            {
                for (int i = 0; i < RetValue.Splits; i++)
                {
                    //(TimeSpan Event_Duration, DateTimeOffset EventStart, DateTimeOffset EventDeadline, TimeSpan EventPrepTime, string myParentID, bool Rigid, Location EventLocation =null, TimeLine RangeOfSubCalEvent = null)
                    EventID          SubEventID     = EventID.GenerateSubCalendarEvent(RetValue.UniqueID.ToString(), i + 1);
                    SubCalendarEvent newSubCalEvent = new DB_SubCalendarEventFly(SubEventID, RetValue.EventName, (RetValue.EndDateTime - RetValue.TimePerSplit), RetValue.EndDateTime, RetValue.Priority, RetValue.myLocation, RetValue.OriginalStart, RetValue.Preparation, RetValue.PreDeadline, RetValue.Rigid, RetValue.UIParam.createCopy(), RetValue.Notes.createCopy(), false, RetValue.ProcrastinationInfo, RetValue.NowInfo, RetValue.RangeTimeLine, true, false, true, RetValue.UserIDs, i);

                    //SubCalendarEvent newSubCalEvent = new SubCalendarEvent(RetValue.TimePerSplit, (RetValue.EndDateTime - RetValue.TimePerSplit), RetValue.End, new TimeSpan(), OriginalStartData, RetValue.UniqueID.ToString(), RetValue.RigidSchedule, RetValue.isEnabled, RetValue.UiParams, RetValue.Notes, RetValue.Complete, i+1, EventLocation, RetValue.RangeTimeLine);
                    RetValue.SubEvents.Add(newSubCalEvent.SubEvent_ID, newSubCalEvent);
                }
            }
            RetValue.EventSequence = new TimeLine(RetValue.StartDateTime, RetValue.EndDateTime);
            RetValue.RepeatRoot    = RepeatRootData;
            RetValue.UpdateLocationMatrix(RetValue.LocationInfo);


            while (!OrginalStartToCalendarEvent.TryAdd(OriginalStartData, RetValue))
            {
                Thread.Sleep(10);
            }


            return(RetValue);
        }
示例#18
0
        /// <summary>
        /// process an event for sendSms service.
        /// </summary>
        /// <param name="targetEvent"></param>
        /// <param name="t"></param>
        public override void ProcessEvent(EventDisplay targetEvent, TraceLog t)
        {
            t.CreateLog(null);
            t.CreateLog($"********************STARTED { TargetActionCode}********************************");
            t.CreateLog("Start Of The Process For Event " + targetEvent.EventId + " And Service Number " + targetEvent.ServiceNumber + " - !!!! ServiceRequest() !!!!");

            using (var EventClientWS = new SelcommWSsvc.SelcommWSAll.EventClient(Singtel.Helpers.Helpers.GetSelcommWsEndpointName()))
                using (var ContactClientWS = new SelcommWSsvc.SelcommWSAll.ContactClient(Singtel.Helpers.Helpers.GetSelcommWsEndpointName()))
                    using (var ServiceClientWS = new SelcommWSsvc.SelcommWSAll.ServiceClient(Singtel.Helpers.Helpers.GetSelcommWsEndpointName()))
                    {
                        // Updating EventSchedule Status to R - START
                        t.CreateLog("Updating Event Status to R- START - EventClientWS.EventScheduleUpdate()");

                        Singtel.Helpers.Helpers.updateEventStatus(SessionKey, targetEvent.EventId, "R", t, null);
                        t.CreateLog("Updating Completed");
                        // Updating EventSchedule Status - END

                        // Loading ServiceDisplay details of a current processing event
                        t.CreateLog("Loading ServiceDisplay Details - ServiceClientWS.ServiceDisplay() For service id: " + targetEvent.ServiceId);
                        var aService = ServiceClientWS.ServiceDisplay(this.ClientSessionWS.SessionKey, new SelcommWSsvc.SelcommWSAll.ServiceDisplay {
                            Id = targetEvent.ServiceId
                        });
                        if (aService != null)
                        {
                            t.CreateLog("ServiceDisplay Details loaded Successfully");
                        }
                        else
                        {
                            t.CreateLog("ServiceDisplay Details not loaded");
                        }

                        var ContactObj       = ContactClientWS.Contact(ClientSessionWS.SessionKey, targetEvent.ContactCode, true, false, false, false);
                        var businessUnitCode = ContactObj.CurrentBusinessUnit.Code;

                        var eventNote = EventClientWS.EventNoteList(ClientSessionWS.SessionKey, targetEvent.EventId, false).FirstOrDefault();

                        try
                        {
                            SendSmsService newSMS = new SendSmsService();
                            sendSms        newMSG = new sendSms();

                            List <string> address  = new List <string>();
                            string        aAddress = aService.ServiceNumber; //"tel:6596165414";
                            var           FirstTwoDigitOfServiceNumber = Helpers.SmscHelper.GetFirstTwoDigitOfServiceNumber(aAddress);
                            if (FirstTwoDigitOfServiceNumber != 65)
                            {
                                aAddress = "tel:65".Trim() + aAddress;
                            }
                            address.Add(aAddress);
                            newMSG.addresses = address.ToArray();
                            newMSG.message   = eventNote?.Text.ToString().Trim();
                            if (newMSG.message == null)
                            {
                                throw new Exception("Message should not be null. Event notes is null.");
                            }
                            newMSG.senderName = GetSystemConfigValue("SG_SMSC_FROM", "SG_SMSC_FROM_" + ContBusUnitCode);
                            t.CreateLog($"Request sent from IOTB:{Utility.SerializeToJSON(newMSG)}");
                            sendSmsResponse newResponse = newSMS.sendSms(newMSG);
                            t.CreateLog($"Response received{Utility.SerializeToJSON(newResponse)}");
                        }

                        catch (Exception ex)
                        {
                            var sx = ex as System.Web.Services.Protocols.SoapException;
                            if (sx != null)
                            {
                                t.CreateLog($"got SoapException. InnerText=\"{sx.Detail.InnerText}\"");
                                t.CreateLog($"OuterXML=\"{sx.Detail.OuterXml}\"");
                            }
                            t.CreateLog("ex.ToString=" + ex.ToString());

                            //record the error and continue with next event
                            t.CreateLog("----------------------------------------!! ERROR OCCURRED !!----------------------------------------");
                            string note = $"ERROR OCCURED. The provisioning action {TargetActionCode} stopped due to the reason: {ex.Message}";
                            t.CreateLog(note);
                            SendEmailToWebSupport(note, t);
                            Singtel.Helpers.Helpers.updateEventStatus(SessionKey, targetEvent.EventId, "F", t, note);
                        }
                    }
        }
示例#19
0
        internal DB_SubCalendarEventFly(EventID EventIDData, string Name, DateTimeOffset StartData, DateTimeOffset EndData, int PriorityData, Location_Elements LocationData, DateTimeOffset OriginalStartData, TimeSpan EventPrepTimeData, TimeSpan Event_PreDeadlineData, bool EventRigidFlagData, EventDisplay UiData, MiscData NoteData, bool CompletionFlagData, Procrastination ProcrastinationData, NowProfile NowProfileData, TimeLine CalendarEventRangeData, bool FromRepeatFlagData, bool ElapsedFlagData, bool EnabledFlagData, List <string> UserIDData, long Sequence)
        {
            this.BusyFrame          = new BusyTimeLine(EventIDData.ToString(), StartData, EndData);
            this.CalendarEventRange = CalendarEventRangeData;
            this.FromRepeatEvent    = FromRepeatFlagData;
            this.EventName          = Name;
            this.EventDuration      = BusyFrame.BusyTimeSpan;
            this.Complete           = CompletionFlagData;
            this.ConflictingEvents  = new ConflictProfile();
            this.DataBlob           = NoteData;
            this.DeadlineElapsed    = ElapsedFlagData;
            this.Enabled            = EnabledFlagData;
            this.StartDateTime      = StartData;
            this.EndDateTime        = EndData;
            this.EventPreDeadline   = Event_PreDeadlineData;
            this.RepetitionSequence = Sequence;
            this.LocationInfo       = LocationData;
            //this.OldPreferredIndex = mySubCalEvent.OldUniversalIndex;
            //this.otherPartyID = mySubCalEvent.ThirdPartyID;
            //this.preferredDayIndex = mySubCalEvent.UniversalDayIndex;
            this.PrepTime                 = EventPrepTimeData;
            this.Priority                 = PriorityData;
            this.ProfileOfNow             = NowProfileData;
            this.ProfileOfProcrastination = ProcrastinationData;
            //this.RepetitionFlag = mySubCalEvent.FromRepeat;
            this.RigidSchedule = EventRigidFlagData;

            this.UiParams = UiData;
            this.UniqueID = EventIDData;

            this.UserIDs       = UserIDData;
            this.OriginalStart = OriginalStartData;
        }
示例#20
0
    // Called at start of action
    public override void Begin(NarrativeEvent newEvent)
    {
        // Call Base Begin Method
        base.Begin(newEvent);

        // Set action type
        type_ = ACTIONTYPE.DECISION;

        //get the world manager
        worldController  = Terrain.activeTerrain.GetComponent <WorldManager>(); //get script
        keyboardControls = UserKeyboardControls.userKeyboardControls;

        // Create references to eventDisplay and resourceManager
        eventDisplay    = EventDisplay.eventDisplay;
        eventController = EventController.eventController;

        // Start decision timer
        decisionTimer_ = new Timer();
        SetDisplayTimer(mainDisplay_.timerLength_);

        // If there are decisions
        if (decisionEffect_.Length > 0)
        {
            // Create btnFunction list
            mainDisplay_.btnFunctions_ = new ButtonDel[decisionEffect_.Length];

            // For each button
            for (int i = 0; i < mainDisplay_.btnFunctions_.Length; i++)
            {
                // Create all effects when button is pressed

                // Add update star method
                mainDisplay_.btnFunctions_[i] += UpdateStars;


                // If there's an event to add
                if (decisionEffect_[i].addEvent_)
                {
                    // Add the AddEventToPool method
                    mainDisplay_.btnFunctions_[i] += AddEventToPool;
                }

                // If there's sound to play
                if (decisionEffect_[i].playSound_)
                {
                    // Add play sound method
                    mainDisplay_.btnFunctions_[i] += PlaySound;
                }

                // if decision has a list of extra actions
                if (decisionEffect_[i].effects_.Count > 0)
                {
                    // Add StartActionList method
                    mainDisplay_.btnFunctions_[i] += StartActionList;
                }

                // Add Exit Decision Method
                mainDisplay_.btnFunctions_[i] += ExitDecision;
            }
        }
        else
        {
            // Else no decisions, set button function to ContinuePressed()
            mainDisplay_.btnFunctions_ = new ButtonDel[1] {
                ExitDecision
            };
        }


        // Set up effect when timer runs out
        timerFinished = UpdateStars;

        if (timerRanOutEffect_.addEvent_)
        {
            timerFinished += AddEventToPool;
        }

        if (timerRanOutEffect_.playSound_)
        {
            timerFinished += PlaySound;
        }

        if (timerRanOutEffect_.effects_.Count > 0)
        {
            timerFinished += StartActionList;
        }
        else
        {
            timerFinished += ExitDecision;
        }



        // Make event display active
        eventDisplay.gameObject.SetActive(true);

        // Display main
        eventDisplay.Display(mainDisplay_, decisionTimer_);

        if (keyboardControls)
        {
            keyboardControls.SetButtons(mainDisplay_.btnFunctions_);
        }
    }