Inheritance: MonoBehaviour
Exemplo n.º 1
0
 public void checkForObject(Interactive aObject)
 {
     //This is an interactiveObject
     if (aObject != null)
     {
         //Do we already have an interactive object?
         if (m_FocusedObject == null)
         {
             //Make an entry call
             //Make a stay call
             m_FocusedObject = aObject;
             m_FocusedObject.onPlayerFocusEnter(this);
             m_FocusedObject.onPlayerFocus(this);
         }
         else if (aObject == m_FocusedObject)
         {
             //Make a stay call
             m_FocusedObject.onPlayerFocus(this);
         }
         //Not Equal and not null
         else if (aObject != m_FocusedObject)
         {
             //Make an exit call on the current focused object
             m_FocusedObject.onPlayerFocusExit(this);
             //Make stay and entry call on the new interactive object
             m_FocusedObject = aObject;
             m_FocusedObject.onPlayerFocusEnter(this);
             m_FocusedObject.onPlayerFocus(this);
         }
     }//end if This is an interactiveObject
 }
Exemplo n.º 2
0
 public override void Act(Interactive interactive, Single deltaTime)
 {
     var n = interactive.Position - Position;
     var d2 = n.LengthSq();
     n.Normalize();
     if (d2 < _RepulsionFactor * _RepulsionDistancePow2)
         interactive.Momentum += n * (_ForceReal / d2);
 }
Exemplo n.º 3
0
 public override void Act(Interactive interactive, Single deltaTime)
 {
     var n = interactive.Position - Position;
     var d2 = n.LengthSq();
     n.Normalize();
     if (Vector3.Dot(n, _Collider.Top) > _AttractionTolerance)
         interactive.Momentum -= n * (_ForceReal / d2);
 }
 void OnTriggerExit(Collider other)
 {
     Interactive auxInteractive = other.GetComponent<Interactive> ();
     if (auxInteractive != null) {
         interactiveObject = null;
         Debug.Log ("Interativo Exit: " + other.name);
     }
 }
 public DebuggerWindow(DebuggerPlugin plugin)
 {
     Plugin = plugin;
     DebuggerMessageHandler = new MessageHandler(this);
     Plugin.RegisterMessageHandler(DebuggerMessageHandler);
     _breakPointSetter = new BreakPointSetter(this);
     _interactive = new Interactive(this);
     InitializeComponent();
 }
 public ItemContactState(ItemCollision itemCollision, Collision collision, Contact contact, Int32 timesReacted)
 {
     Interactive = itemCollision.Interactive;
     TimesReacted = timesReacted;
     Collision = collision;
     Contact = contact;
     Point = contact.PointB;
     Radius = Point - Interactive.Position;
     Normal = contact.NormalAB;
     Velocity = Interactive.GetVelocityAt(Radius);
     Approach = -Vector3.Dot(Normal, Velocity);
     Momentum = Interactive.GetForceAt(Radius);
     Weight = -Vector3.Dot(Normal, Momentum);
     Orthonormal = Normal.Orthonormal(Velocity);
 }
Exemplo n.º 7
0
 internal static DataTable GetAllFacilitys()
 {
     FacilityInfo.Recs = false;
     try
     {
         dt         = new DataTable();
         daFacility = new TblFacilityTableAdapter();
         dtFacility = new DsLiveOutlook.TblFacilityDataTable();
         daFacility.Fill(dtFacility);
         dt = dtFacility;
         if (dt.Rows.Count > 0)
         {
             FacilityInfo.Recs = true;
         }
     }
     catch (Exception ex)
     {
         Interactive.LInfoError("Could not load Facility Information\n" + ex.Message, "Database connection failure");
     }
     return(dt);
 }
Exemplo n.º 8
0
 internal static DataTable GetAllReservesByID()
 {
     try
     {
         ReserveInfo.Recs = false;
         dt        = new DataTable();
         daReserve = new TblReserveTableAdapter();
         dtReserve = new DsLiveOutlook.TblReserveDataTable();
         daReserve.FillByID(dtReserve, ReserveInfo.Day, ReserveInfo.Month, ReserveInfo.Year);
         dt = dtReserve;
         if (dt.Rows.Count > 0)
         {
             ReserveInfo.Recs = true;
         }
     }
     catch (Exception ex)
     {
         Interactive.LInfoError("Could not load Reserve Information\n" + ex.Message, "Database connection failure");
     }
     return(dt);
 }
Exemplo n.º 9
0
    /// <summary>
    /// Private method which checks for an interactive item with a raycast.
    /// </summary>
    private void CheckForInteractive()
    {
        // If the raycast detects an object.
        if (Physics.Raycast(_cameraTransform.position,
                            _cameraTransform.forward,
                            out RaycastHit hitInfo,
                            MAX_INTERACTION_DISTANCE))
        {
            Interactive interactive =
                hitInfo.transform.GetComponent <Interactive>();

            // Sees if it has an interactive script.
            if (interactive == null)
            {
                ClearCurrentInteractive();
            }
            else if (interactive != _currentInteractive)
            {
                SetCurrentInteractive(interactive);
            }
        }
Exemplo n.º 10
0
 internal static DataTable GetAllEnrollmentsByID()
 {
     try
     {
         EnrollmentInfo.Recs = false;
         dt           = new DataTable();
         daEnrollment = new TblEnrollmentTableAdapter();
         dtEnrollment = new DsLiveOutlook.TblEnrollmentDataTable();
         daEnrollment.FillByID(dtEnrollment, EnrollmentInfo.RegNo);
         dt = dtEnrollment;
         if (dt.Rows.Count > 0)
         {
             EnrollmentInfo.Recs = true;
         }
     }
     catch (Exception ex)
     {
         Interactive.LInfoError("Could not load Enrollment Information\n" + ex.Message, "Database connection failure");
     }
     return(dt);
 }
Exemplo n.º 11
0
 internal static DataTable GetAllClassifications()
 {
     ClassificationInfo.Recs = false;
     try
     {
         dt = new DataTable();
         daClassification = new TblClassificationTableAdapter();
         dtClassification = new DsLiveOutlook.TblClassificationDataTable();
         daClassification.Fill(dtClassification);
         dt = dtClassification;
         if (dt.Rows.Count > 0)
         {
             ClassificationInfo.Recs = true;
         }
     }
     catch (Exception ex)
     {
         Interactive.LInfoError("Could not load Classification Information\n" + ex.Message, "Database connection failure");
     }
     return(dt);
 }
Exemplo n.º 12
0
 public void CreateLiveDirectories(bool interactive)
 {
     try
     {
         bw.ReportProgress(1);
         if (!Directory.Exists(Dir))
         {
             Directory.CreateDirectory(Dir);
         }
         if (!Directory.Exists(DirBak))
         {
             Directory.CreateDirectory(DirBak);
         }
         bw.ReportProgress(2);
     }
     catch (Exception ex)
     {
         Interactive.LInfoError("Could not create directory !\n" + ex.Message, "Application Failure");
         Application.Exit();
     }
 }
Exemplo n.º 13
0
 internal int Authenticate(UserInfo r)
 {
     n = -1;
     try
     {
         string pass = string.Empty;
         da   = new tblUserTableAdapter();
         pass = da.GetPassword(r.UserID).ToString();
         n    = string.Compare(r.Password, pass);
     }
     catch (NullReferenceException exI)
     {
         n = -1;
     }
     catch (Exception ex)
     {
         Interactive.LInfoError(ex.Message, "Check User");
     }
     LivelogInfo.InsertLog(DateTime.Now, "-", "-", UserInfo.LiveUserID, "Authenticating...", UserInfo.SysUserID, UserInfo.Computer);
     return(n);
 }
Exemplo n.º 14
0
        public static bool VerifyLogSetup()
        {
            if (LogManager.Configuration is null || LogManager.Configuration.AllTargets.Count == 0)
            {
                Console.WriteLine("No or empty NLog config found.\n" +
                                  "You can copy the default config from TS3AudioBot/NLog.config.\n" +
                                  "Please refer to https://github.com/NLog/NLog/wiki/Configuration-file " +
                                  "to learn more how to set up your own logging configuration.");

                if (LogManager.Configuration is null)
                {
                    Console.WriteLine("Create a default config to prevent this step.");
                    Console.WriteLine("Do you want to continue? [y/N]");
                    if (!Interactive.UserAgree(defaultTo: false))
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Exemplo n.º 15
0
    public void HandleInputs()
    {
        Ray ray = playerCamera.ScreenPointToRay(new Vector3(Screen.width / 2, Screen.height / 2, 0));

        if (Physics.Raycast(ray, out RaycastHit hit, reachDistance, layerMask))
        {
            Interactive interactive = hit.transform.GetComponentInParent <Interactive>();
            if (interactive != null)
            {
                interactive.Hover(hit);
                if (Input.GetButtonDown("Fire1"))
                {
                    interactive.LeftClick(hit);
                }
                if (Input.GetButtonDown("Fire2"))
                {
                    interactive.RightClick(hit);
                }
            }
        }
    }
Exemplo n.º 16
0
 internal static DataTable GetAllSettingssByID()
 {
     try
     {
         SettingsInfo.Recs = false;
         dt         = new DataTable();
         daSettings = new TblSettingsTableAdapter();
         dtSettings = new DsLiveOutlook.TblSettingsDataTable();
         daSettings.FillByID(dtSettings, SettingsInfo.ADay);
         dt = dtSettings;
         if (dt.Rows.Count > 0)
         {
             SettingsInfo.Recs = true;
         }
     }
     catch (Exception ex)
     {
         Interactive.LInfoError("Could not load Settings Information\n" + ex.Message, "Database connection failure");
     }
     return(dt);
 }
Exemplo n.º 17
0
 internal static DataTable GetAllPublicHolidaysByID()
 {
     try
     {
         PublicHolidayInfo.Recs = false;
         dt = new DataTable();
         daPublicHoliday = new TblPublicHolidayTableAdapter();
         dtPublicHoliday = new DsLiveOutlook.TblPublicHolidayDataTable();
         daPublicHoliday.FillByID(dtPublicHoliday, PublicHolidayInfo.Day, PublicHolidayInfo.Month);
         dt = dtPublicHoliday;
         if (dt.Rows.Count > 0)
         {
             PublicHolidayInfo.Recs = true;
         }
     }
     catch (Exception ex)
     {
         Interactive.LInfoError("Could not load PublicHoliday Information\n" + ex.Message, "Database connection failure");
     }
     return(dt);
 }
Exemplo n.º 18
0
    // Read from dialog file and handle the text.
    private void HandleDialog()
    {
        string txtContent = txtAsset.text;

        // Buttons will be generated automatically according to the text file. Position, rotation, script variables need to set up as well
        string titles    = txtContent.Split('(') [0];
        int    buttonNum = titles.Split(',').Length;

        bottuns = new GameObject[buttonNum];
        for (int i = 0; i < buttonNum; i++)
        {
            bottuns [i] = Instantiate(buttonPrefab, transform.position, transform.rotation, transform);
            bottuns [i].transform.localRotation *= Quaternion.Euler(0, 180, 0);
            bottuns [i].transform.localPosition  = new Vector3(0.3f, 0.673f, 0.3f);
            bottuns[i].transform.localPosition  += new Vector3(0f, -0.1f * i, 0f);

            // Words shown on button are separated by , in the text file.
            bottuns[i].GetComponent <LabelTheme>().Default = titles.Split(',')[i];
            if (i == buttonNum - 1)
            {
                bottuns[i].GetComponent <LabelTheme>().Default = '\n' + titles.Split(',')[i];
            }

            // Setup the button's select function
            Interactive buttonInteractive = bottuns[i].GetComponent <Interactive>();
            // local variable is needed for delegate function
            int option = i;
            buttonInteractive.OnSelectEvents.AddListener(delegate { ButtonInteraction(option); });
        }

        // Save each dialog.
        Regex           regex_dialog = new Regex(@"\(.*?\)");
        MatchCollection matches      = regex_dialog.Matches(txtContent);

        answerText = new string[matches.Count];
        for (int i = 0; i < matches.Count; i++)
        {
            answerText[i] = DialogNewLine(matches[i].Value);
        }
    }
Exemplo n.º 19
0
        public async Task DisplayAsync()
        {
            var embed   = BuildEmbed();
            var message = await Context.Channel.SendMessageAsync(_pager.Content, embed : embed).ConfigureAwait(false);

            Message = message;
            Interactive.AddReactionCallback(message, this);
            // Reactions take a while to add, don't wait for them
            _ = Task.Run(async() =>
            {
                await message.AddReactionAsync(Options.First);
                await message.AddReactionAsync(Options.Back);
                await message.AddReactionAsync(Options.Next);
                await message.AddReactionAsync(Options.Last);

                var manageMessages = (Context.Channel is IGuildChannel guildChannel) && ((IGuildUser)Context.User).GetPermissions(guildChannel).ManageMessages;

                if (Options.JumpDisplayOptions == JumpDisplayOptions.Always ||
                    (Options.JumpDisplayOptions == JumpDisplayOptions.WithManageMessages && manageMessages))
                {
                    await message.AddReactionAsync(Options.Jump);
                }

                await message.AddReactionAsync(Options.Stop);

                if (Options.DisplayInformationIcon)
                {
                    await message.AddReactionAsync(Options.Info);
                }
            });
            // TODO: (Next major version) timeouts need to be handled at the service-level!
            if (Timeout.HasValue)
            {
                _ = Task.Delay(Timeout.Value).ContinueWith(_ =>
                {
                    Interactive.RemoveReactionCallback(message);
                    _ = Message.DeleteAsync();
                });
            }
        }
Exemplo n.º 20
0
        public async Task BulkAsync(string reason = null)
        {
            var oldChannel = (ITextChannel)Context.Channel;
            await oldChannel.DeleteAsync();

            var channel = (ITextChannel)await Context.Guild.CreateTextChannelAsync(Context.Channel.Name);

            await channel.ModifyAsync(x =>
            {
                x.IsNsfw     = oldChannel.IsNsfw;
                x.Topic      = oldChannel.Topic;
                x.CategoryId = oldChannel.CategoryId;
                x.Position   = oldChannel.Position;
            });

            foreach (var permissionOverwrite in oldChannel.PermissionOverwrites)
            {
                switch (permissionOverwrite.TargetType)
                {
                case PermissionTarget.Role:
                    var role = Context.Guild.GetRole(permissionOverwrite.TargetId);
                    await channel.AddPermissionOverwriteAsync(role, permissionOverwrite.Permissions);

                    break;

                case PermissionTarget.User:
                    var user = Context.Guild.GetUser(permissionOverwrite.TargetId);
                    await channel.AddPermissionOverwriteAsync(user, permissionOverwrite.Permissions);

                    break;
                }
            }
            await Interactive.ReplyAndDeleteAsync(channel,
                                                  embed : NormalizeEmbed("Chat Cleared", "Deleted all messages from this channel").Build());

            var logItem = _serverService.AddLogItem(Server, ActionType.Bulk, reason, Context.User.Id, 0);
            await _logService.SendLog(Context.Guild, "Bulk delete",
                                      $"Responsible User ❯ {Context.User.Mention}\nChannel ❯ {channel.Mention}\nReason ❯ {reason ?? $"none, {Context.User.Mention} use {$"reason {logItem.LogId} <reason>".InlineCode()}"}\nId ❯ {logItem.LogId}",
                                      server : Server);
        }
Exemplo n.º 21
0
    void Start()
    {
        if (State == CustomerState.Uninitialized)
        {
            State = CustomerState.WaitingToBeSeated;
            if (Random.Range(0.0f, 1.0f) > 0.5f)
            {
                SpawnPlusOne();
            }
        }

        interactive = GetComponent <Interactive>();
        interactive.SetInteraction(Interact, ValidateInteraction);

        if (MealManager.Instance)
        {
            desiredMeal = MealManager.Instance.GenerateMeal();
        }

        rigidBody = GetComponent <Rigidbody2D>();
        if (!rigidBody)
        {
            Debug.LogError(
                string.Format("Failed to retrieve RigidBody2D on {0}", gameObject.name));
        }

        collider = GetComponent <CircleCollider2D>();
        if (!collider)
        {
            Debug.LogError(
                string.Format("Failed to retrieve CircleCollider2D on {0}", gameObject.name));
        }

        audioSource = GetComponent <AudioSource>();
        if (!audioSource)
        {
            Debug.LogError(
                string.Format("Failed to retrieve AudioSource on {0}", gameObject.name));
        }
    }
Exemplo n.º 22
0
    private void Update()
    {
        // Has hit anything
        if (Raycast(out var hit))
        {
            currentInteractive = hit.transform.GetComponent <Interactive>();
            // Hit something with Interactive component
            if (currentInteractive && currentInteractive.active)
            {
                if (Input.GetKeyDown(KeyCode.E))
                {
                    currentInteractive.Interaction();
                }
                size += 2 * crosshairChangeSpeed * Time.deltaTime;
            }
        }
        size -= crosshairChangeSpeed * Time.deltaTime;

        // Change size of crosshair
        size = Mathf.Clamp(size, crosshairSize.x, crosshairSize.y);
        crosshair.sizeDelta = new Vector2(size, size);
    }
Exemplo n.º 23
0
        public void CreateConfigIfNotExists(bool interactive = false)
        {
            if (File.Exists(config.Path))
            {
                return;
            }

            Log.Warn("No permission file found.");

            var settings = new CreateFileSettings
            {
                OverwriteIfExists = false,
            };

            if (interactive)
            {
                Console.WriteLine("Do you want to set up an admin in the default permission file template? [Y/n]");
                if (Interactive.UserAgree(defaultTo: true))
                {
                    var adminUid = Interactive.LoopAction("Please enter an admin uid", uid =>
                    {
                        if (!Uid.IsValid(uid))
                        {
                            Console.WriteLine("The uid seems to be invalid, continue anyway? [y/N]");
                            return(Interactive.UserAgree(defaultTo: false));
                        }
                        return(true);
                    });
                    if (adminUid is null)
                    {
                        return;
                    }

                    settings.AdminUids = new[] { adminUid };
                }
            }

            CreateConfig(settings);
        }
Exemplo n.º 24
0
        public ReturnData Update(object request)
        {
            RequesList <Emenu> menu        = (RequesList <Emenu>)request;
            Interactive        interactive = new Interactive();

            interactive.Update(menu.Model);
            if (interactive.Result.Item1)
            {
                var items = new List <KeyValuePair <long, string> >();
                items.Add(new KeyValuePair <long, string>(menu.Model.Id, Convert.ToString(menu.Model.Id)));
                Client.UpdateAsyc <Emenu>(GetKey(), items, menu.Model, "Id");
                return(new ReturnData {
                    sucess = Client.Sucess
                });
            }
            else
            {
                return(new ErrorData {
                    sucess = Client.Sucess, code = Client.Code
                });
            }
        }
Exemplo n.º 25
0
 internal static bool IsReservedDay()
 {
     n = 0;
     try
     {
         dt        = new DataTable();
         daReserve = new TblReserveTableAdapter();
         n         = Convert.ToInt32(daReserve.GetReserveDay(AppointmentInfo.Appointment.Day, AppointmentInfo.Appointment.Month, AppointmentInfo.Appointment.Year));
     }
     catch (Exception ex)
     {
         Interactive.LInfoError("Could not load Reserve Information\n" + ex.Message, "Database connection failure");
     }
     if (n == 1)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 26
0
        public bool UpdateVersion()
        {
            try
            {
                daLive = new TblLiveTableAdapter();


                n = daLive.UpdateVersion(LiveStart.LiveDbVersion, LiveStart.LiveProduct);
            }
            catch (Exception ex)
            {
                Interactive.LInfoError("Could not update database\n" + ex.Message, "Application Failure");
            }
            if (n > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
 public ActionResult InteractiveEdit(FormCollection form)
 {
     if (!string.IsNullOrEmpty(Session["username"] as string))
     {
         try
         {
             List <Interactive> lst = new List <Interactive>();
             for (int i = 1; i <= 2; i++)
             {
                 Interactive obj = new Interactive();
                 obj.Month1  = !string.IsNullOrEmpty(form["Month1" + i]) ? form["Month1" + i] : string.Empty;
                 obj.Month2  = !string.IsNullOrEmpty(form["Month2" + i]) ? form["Month2" + i] : string.Empty;
                 obj.Year1   = !string.IsNullOrEmpty(form["Year1" + i]) ? form["Year1" + i] : string.Empty;
                 obj.Year2   = !string.IsNullOrEmpty(form["Year2" + i]) ? form["Year2" + i] : string.Empty;
                 obj.Change1 = !string.IsNullOrEmpty(form["Change1" + i]) ? form["Change1" + i] : string.Empty;
                 obj.Change2 = !string.IsNullOrEmpty(form["Change2" + i]) ? form["Change2" + i] : string.Empty;
                 lst.Add(obj);
             }
             Header header = new Header();
             header.Month1 = !string.IsNullOrEmpty(form["Month1"]) ? form["Month1"] : string.Empty;;
             header.Month2 = !string.IsNullOrEmpty(form["Month2"]) ? form["Month2"] : string.Empty;;
             header.Year1  = !string.IsNullOrEmpty(form["Year1"]) ? form["Year1"] : string.Empty;
             header.Year2  = !string.IsNullOrEmpty(form["Year2"]) ? form["Year2"] : string.Empty;
             header.Year3  = !string.IsNullOrEmpty(form["Year3"]) ? form["Year3"] : string.Empty;
             header.Year4  = !string.IsNullOrEmpty(form["Year4"]) ? form["Year4"] : string.Empty;
             CustomerServiceData csd = new CustomerServiceData();
             csd.UpdateInteractiveData(lst, header);
             return(RedirectToAction("Index"));
         }
         catch (Exception ex)
         {
             return(View("Error", ex));
         }
     }
     else
     {
         return(RedirectToAction("Index", "Login"));
     }
 }
Exemplo n.º 28
0
        private DragDropEffects DragOver(IInputElement inputRoot, Point point, IDataObject data, DragDropEffects effects)
        {
            var target = GetTarget(inputRoot, point);

            if (target == _lastTarget)
            {
                return(RaiseDragEvent(target, DragDrop.DragOverEvent, effects, data));
            }

            try
            {
                if (_lastTarget != null)
                {
                    _lastTarget.RaiseEvent(new RoutedEventArgs(DragDrop.DragLeaveEvent));
                }
                return(RaiseDragEvent(target, DragDrop.DragEnterEvent, effects, data));
            }
            finally
            {
                _lastTarget = target;
            }
        }
Exemplo n.º 29
0
        public async Task DisplayAsync()
        {
            var embed   = BuildEmbed();
            var message = await Context.Channel.SendMessageAsync(_pager.MessageText, embed : embed).ConfigureAwait(false);

            Message = message;
            Interactive.AddReactionCallback(message, this);
            // Reactions take a while to add, don't wait for them
            _ = Task.Run(async() =>
            {
                if (_pager.PageCount > 4)
                {
                    await message.AddReactionAsync(options.First);
                }

                await message.AddReactionAsync(options.Back);
                await message.AddReactionAsync(options.Next);

                if (_pager.PageCount > 4)
                {
                    await message.AddReactionAsync(options.Last);
                }

                if (_pager.PageCount > 4)
                {
                    await message.AddReactionAsync(options.Jump);
                }
            });
            // TODO: (Next major version) timeouts need to be handled at the service-level!
            if (Timeout.HasValue)
            {
                _ = Task.Delay(Timeout.Value).ContinueWith(_ =>
                {
                    Interactive.RemoveReactionCallback(message);
                    message.RemoveAllReactionsAsync();
                });
            }
        }
Exemplo n.º 30
0
            public override async Task <bool> RunAsync(CancellationToken cancellationToken = default)
            {
                if (!await base.RunAsync(cancellationToken) || Interactive.Source?.Id != Context.User.Id)
                {
                    return(false);
                }

                switch (Trigger._destination)
                {
                case JumpDestination.Start:

                    if (Interactive.Position == 0)
                    {
                        Interactive.Position = -1;
                    }
                    else
                    {
                        Interactive.Position = 0;
                    }

                    break;

                case JumpDestination.End:

                    if (Interactive.Position == Trigger._endPosition)
                    {
                        Interactive.Position = Trigger._endPosition + 1;
                    }
                    else
                    {
                        Interactive.Position = Trigger._endPosition;
                    }

                    break;
                }

                return(await Interactive.UpdateViewAsync(_services, cancellationToken));
            }
Exemplo n.º 31
0
 internal static bool WorkingDayOK(string ageunit, int age)
 {
     n = 0;
     try
     {
         dt         = new DataTable();
         daSettings = new TblSettingsTableAdapter();
         n          = Convert.ToInt32(daSettings.GetCapacity(AppointmentInfo.Appointment.ToString("dddd")));
         // System.Windows.Forms.MessageBox.Show(AppointmentInfo.Appointment.ToString("dd/MM/yyy") + "\n" + "Capacity" + AppointmentInfo.Appointment.ToString("dddd") + " :" + n.ToString());
     }
     catch (Exception ex)
     {
         Interactive.LInfoError("Could not load Reserve Information\n" + ex.Message, "Database connection failure");
     }
     if (AppointmentInfo.Capacity() > n)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
Exemplo n.º 32
0
 internal static bool IsHoliday()
 {
     n = 0;
     try
     {
         dt = new DataTable();
         daPublicHoliday = new TblPublicHolidayTableAdapter();
         n = Convert.ToInt32(daPublicHoliday.IsHoliday(AppointmentInfo.Appointment.Day, AppointmentInfo.Appointment.Month));
         //System.Windows.Forms.MessageBox.Show(AppointmentInfo.Appointment.ToString("dd/MM/yyy")+"\n"+ " Holiday:" + n.ToString());
     }
     catch (Exception ex)
     {
         Interactive.LInfoError("Could not load PublicHoliday Information\n" + ex.Message, "Database connection failure");
     }
     if (AppointmentInfo.Capacity() > n)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
Exemplo n.º 33
0
 internal static bool IsReserve()
 {
     n = 0;
     try
     {
         dt        = new DataTable();
         daReserve = new TblReserveTableAdapter();
         n         = Convert.ToInt32(daReserve.ReserveApointments(AppointmentInfo.Appointment.Day, AppointmentInfo.Appointment.Month, AppointmentInfo.Appointment.Year));
         // System.Windows.Forms.MessageBox.Show(n.ToString());
     }
     catch (Exception ex)
     {
         Interactive.LInfoError("Could not load Reserve Information\n" + ex.Message, "Database connection failure");
     }
     if (AppointmentInfo.Capacity() > n)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 34
0
        private DragDropEffects RaiseDragEvent(Interactive target, IInputElement inputRoot, Point point, RoutedEvent <DragEventArgs> routedEvent, DragDropEffects operation, IDataObject data, InputModifiers modifiers)
        {
            if (target == null)
            {
                return(DragDropEffects.None);
            }

            var p = inputRoot.TranslatePoint(point, target);

            if (!p.HasValue)
            {
                return(DragDropEffects.None);
            }

            var args = new DragEventArgs(routedEvent, data, target, p.Value, modifiers)
            {
                RoutedEvent = routedEvent,
                DragEffects = operation
            };

            target.RaiseEvent(args);
            return(args.DragEffects);
        }
Exemplo n.º 35
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public override ReturnData Delete(object request)
        {
            RequesList <Emenu> menu        = (RequesList <Emenu>)request;
            Interactive        interactive = new Interactive();

            interactive.Delete(menu.Model);
            var items = new List <KeyValuePair <long, string> >();

            if (interactive.Result.Item1)
            {
                items.Add(new KeyValuePair <long, string>(menu.Model.Id, Convert.ToString(menu.Model.Id)));
                Client.RemoveAsync <Emenu>(GetKey(), items, "Id");
                return(new ReturnData {
                    sucess = Client.Sucess, msg = menu.Model.Id.ToString()
                });
            }
            else
            {
                return(new ErrorData {
                    sucess = Client.Sucess, code = Client.Code, msg = "关系型数据库出错"
                });
            }
        }
Exemplo n.º 36
0
        /// <summary>
        /// 新增修改
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public override ReturnData Add(object request)
        {
            RequesList <Emenu> menu        = (RequesList <Emenu>)request;
            Interactive        interactive = new Interactive();

            interactive.Insert(menu.Model);
            if (interactive.Result.Item1)
            {
                menu.Model.Id = interactive.Result.Item2;
                var values = new List <KeyValuePair <long, string> >();
                values.Add(new KeyValuePair <long, string>(menu.Model.Id, menu.Model.ToJson()));
                Client.AddZsetAsync(GetKey(), values);
                return(new ReturnData {
                    sucess = Client.Sucess, msg = interactive.Result.Item2.ToString()
                });
            }
            else
            {
                return(new ErrorData {
                    sucess = Client.Sucess, code = Client.Code
                });
            }
        }
Exemplo n.º 37
0
 protected override void InformPmAdditional(Interactive.PokemonAdditionalInfo pminfo)
 {
     error("收到非法的消息,数据包损毁或房间主机程序被修改");
 }
Exemplo n.º 38
0
 public void ReleaseFocus()
 {
     activeFocus = focusHistory.Count == 0 ? null : focusHistory.Pop();
 }
Exemplo n.º 39
0
 public virtual void Act(Interactive interactive, Single deltaTime)
 {
 }
Exemplo n.º 40
0
 public override void LoadValues()
 {
     _ChargeSound.dispose();
     _ChargeSound = Game.Current.GetSound("CannonCharge.wav", 0);
     _Base.Rotation = _BaseRotationSaved;
     RotationTarget = _RotationTargetSaved;
     _IsRotationTarget = _IsRotationTargetSaved;
     base.LoadValues();
     OnScaleChanged();
     _Load = null;
     _Smoke.Stop();
 }
Exemplo n.º 41
0
 public virtual bool IsChild(Interactive parent)
 {
     return false;
 }
Exemplo n.º 42
0
Arquivo: Player.cs Projeto: sunoru/PBO
 protected override void InformPmAdditional(Interactive.PokemonAdditionalInfo info)
 {
     game.Update(info);
 }
Exemplo n.º 43
0
 //Disables the player Camera and unit motor
 //Invokes an the interactive object's onUseEnd
 public void use(Interactive aInteractiveObject)
 {
     if (aInteractiveObject == null)
     {
         return;
     }
     if (m_ObjectInUse != null)
     {
         m_ObjectInUse.onUseEnd(this);
     }
     disableCamera();
     disableUnitMotor();
     m_ObjectInUse = aInteractiveObject;
     m_ObjectInUse.onUse(this);
 }
Exemplo n.º 44
0
 public void stopUsing()
 {
     if (m_ObjectInUse != null)
     {
         m_ObjectInUse.onUseEnd(this);
     }
     m_ObjectInUse = null;
     enableCamera();
     enableUnitMotor();
 }
Exemplo n.º 45
0
        public void update(GameTime time)
        {
            int elapsed = time.ElapsedGameTime.Milliseconds;
            frameTime += elapsed;
            checkInput(control);
            drawLayer = DrawLayer.Player;

            switch (state)
            {
                case BoyState.Idle:
                    if (Animation == "pushstill" || Animation == "startpush" || Animation == "push")
                    {
                        Animation = "endpush";

                        if (soundCue != null)
                        {
                            soundCue.Stop(AudioStopOptions.Immediate);
                        }
                    }
                    if (Animation == "control")
                    {
                        Animation = "controlend";
                    }
                    if ((Animation == "endpush" || Animation == "controlend") && frame == 2 || Animation == "walk")
                    {
                        Animation = "stand";
                    }

                    moveSpeedX = 0;
                    moveSpeedY = 0;
                    break;
                case BoyState.Walk:
                    Animation = "walk";
                    moveSpeedX = 3;
                    moveSpeedY = 0;
                    control.hideDialogue();
                    break;
                case BoyState.StairsLeft:
                    Animation = "walk";
                    moveSpeedX = 3;
                    moveSpeedY = 2;
                    drawLayer = DrawLayer.PlayerBehindStairs;
                    break;
                case BoyState.StairsRight:
                    Animation = "walk";
                    moveSpeedX = 3;
                    moveSpeedY = -2;
                    drawLayer = DrawLayer.PlayerBehindStairs;
                    break;
                case BoyState.PushingStill:
                    if (soundCue != null)
                    {
                        soundCue.Stop(AudioStopOptions.Immediate);
                    }

                    moveSpeedX = 0;
                    moveSpeedY = 0;
                    if (Animation == "walk" || Animation == "stand")
                         Animation = "startpush";
                    if (Animation == "startpush" && frame == 3 || Animation == "push")
                        Animation = "pushstill";
                    break;
                case BoyState.PushWalk:
                    moveSpeedY = 0;
                    if (Animation == "walk" || Animation == "stand")
                    {
                        moveSpeedX = 0;
                        Animation = "startpush";
                    }
                    if (Animation == "startpush" && frame == 3 || Animation == "pushstill")
                    {
                        Animation = "push";
                        pushSoundTimer = 201;
                    }
                    if (Animation == "push")
                        moveSpeedX = 3;
                    break;

                case BoyState.Teleport:
                    moveSpeedX = 0;
                    moveSpeedY = 0;
                    if (Animation == "walk" || Animation == "stand")
                    {
                        Animation = "enterwardrobe";
                        Wardrobe targetWR = ((Wardrobe)interactor).getLinkedWR();
                        if (targetWR != null)
                        {
                            Rectangle target = targetWR.getBounds();
                            teleportTo = new Vector2(target.X + 16, target.Y + 24);
                            interactor = null;
                        }
                    }
                    if (Animation == "enterwardrobe" && frame == 6)
                    {
                        position = new Vector2(teleportTo.X, teleportTo.Y);
                        Animation = "leavewardrobe";
                    }
                    if (Animation == "leavewardrobe" && frame == 7)
                    {
                        Animation = "stand";
                        state = BoyState.Idle;
                    }
                    break;
                case BoyState.TimeTravel:
                    moveSpeedX = 0;
                    moveSpeedY = 0;
                    if (Animation == "walk" || Animation == "stand")
                    {
                        Portrait p = (Portrait)interactor;
                        if (p.wasMoved)
                            teleportTo = p.movedPos;
                        else
                            teleportTo = new Vector2();
                        Animation = "enterportrait";
                        if (control.timePeriod == TimePeriod.Present) 
                            timeTravelTo = ((Portrait)interactor).sendTime;
                        interactor = null;
                    }
                    if (Animation == "enterportrait" && frame == 7)
                    {
                        if (control.timePeriod != TimePeriod.Present)
                            control.timePeriod = TimePeriod.Present;
                        else
                            control.timePeriod = timeTravelTo;
                        Animation = "leaveportrait";
                        if (teleportTo.X != 0 && teleportTo.Y != 0)
                        {
                            X = teleportTo.X;
                            Y = teleportTo.Y;
                        }
                    }
                    if (Animation == "leaveportrait" && frame == 7)
                    {
                        Animation = "stand";
                        state = BoyState.Idle;
                    }
                    break;
                case BoyState.ControllingChair:
                    moveSpeedX = 0;
                    moveSpeedY = 0;
                    if (Animation != "control")
                    {
                        Animation = "controlstart";
                    }
                    if (Animation == "controlstart" && frame == 2)
                        Animation = "control";
                    break;
                case BoyState.Die:
                    moveSpeedX = 0;
                    moveSpeedY = 0;
                    Animation = "disappear";
                    if (frame == 7)
                    {
                        reset();
                        control.resetLevel();
                    }
                    break;
            }
            if (frameTime >= frameLength)
            {
                int flip = 1;
                if (direction == Direction.Left)
                    flip = -1;
                X += moveSpeedX * flip;
                if (state == BoyState.PushWalk && Animation == "push" && interactor != null)
                {
                    pushSoundTimer += elapsed;
                    Wardrobe w = (Wardrobe)interactor;
                    if (!control.collidingWithSolid(w.pushBox, false))
                    {
                        w.X += (int)(moveSpeedX * flip);
                        if (pushSoundTimer > 200 && GameTitle.toggleSound)
                        {
                            soundCue = soundMan.playSound("Pushing Wardrobe", 0);
                            pushSoundTimer = 0;
                        }
                    }
                    else
                        X -= moveSpeedX * flip;
                }
                if (moveSpeedY == 0)
                {
                    moveSpeedY = 1;
                    flip = 1;
                }
                Y += moveSpeedY * flip;
                frameTime = 0;
                frame = (frame + 1) % animFrames.Count;
            }
        }
Exemplo n.º 46
0
 public void CaptureFocus(Interactive newFocus)
 {
     if (activeFocus != null)
         focusHistory.Push(activeFocus);
     activeFocus = newFocus;
 }
Exemplo n.º 47
0
 public ItemCollision(Item item, Interactive interactive, Collision[] collisions)
 {
     this.Item = item;
     this.Interactive = interactive;
     this.Collisions = collisions;
 }
Exemplo n.º 48
0
 public override void Act(Interactive interactive, Single deltaTime)
 {
     interactive.Momentum += Scale * interactive.Mass;
 }
Exemplo n.º 49
0
 private void _Shoot()
 {
     _ChargeSound.dispose();
     _ChargeSound = Game.Current.GetSound("CannonCharge.wav", 0);
     var d = _LoadColider.Orientation[1];
     _Load.Position += d * (_LoadColiderExtents.Y + 1);
     _Load.Velocity = d * _ForceReal;
     _Load = null;
     _Smoke.Start();
 }
Exemplo n.º 50
0
 public override void Act(Interactive interactive, Single deltaTime)
 {
     var n = interactive.Position - Position;
     var d2 = n.LengthSq();
     n.Normalize();
     if (d2 < _AtractionFactor * _AtractionDistancePow2)
     {
         _StarStorm.KeepPlaying();
         interactive.Momentum -= n * (_ForceReal / d2);
     }
 }
Exemplo n.º 51
0
 public ItemCollision Collide(Interactive interactive)
 {
     if (this == interactive) return null;
     var collisions = new List<Collision>();
     foreach (var c in _Colliders)
         foreach (var ic in interactive._Colliders)
         {
             var collision = c.Collide(ic);
             if (collision != null)
                 collisions.Add(collision);
         }
     if (collisions.Count == 0) return null;
     var itemCollision = new ItemCollision(this, interactive, collisions.ToArray());
     OnCollision(itemCollision);
     return itemCollision;
 }
Exemplo n.º 52
0
    /// <summary>
    /// 
    /// </summary>
    void FixedUpdate()
    {
        if (m_OrbitCamera == null)
        {
            Debug.Log("Please attach a camera with an Orbit Camera script to this script");
            return;
        }

        Vector3 origin = m_OrbitCamera.transform.position;
        Vector3 direction = m_OrbitCamera.transform.forward;

        //The layer mask is for objects this raycast is to check for only.
        int m_LayerMask = 1 << 8;
        RaycastHit hit;
        //Raycast from the cameras current position forwards to see if an interactive object gets hit
        if (Physics.Raycast(origin, direction, out hit, 500.0f, m_LayerMask))
        {
            //What transform was hit
            Transform hitForm = hit.transform;
            //What point was hit xyz
            Vector3 hitPoint = hit.point;
            Interactive interactiveObject = hitForm.GetComponent<Interactive>();
            if (interactiveObject != null)
            {
                checkForObject(interactiveObject);
            }
            else
            {
                Transform parent = hitForm.parent;
                if (parent != null)
                {
                    interactiveObject = parent.GetComponent<Interactive>();
                    if (interactiveObject != null)
                    {
                        checkForObject(interactiveObject);
                    }
                }
            }
        }
        //No Valid collider
        else
        {
            if (m_FocusedObject != null)
            {
                m_FocusedObject.onPlayerFocusExit(this);
                m_FocusedObject = null;
            }
        }
    }
Exemplo n.º 53
0
 public override void Act(Interactive interactive, Single deltaTime)
 {
     if (_Load != null) return;
     var p = interactive.Position;
     if (_LoadColider.ClosestPoint(p) == p)
     {
         _Load = interactive;
         _IsRotationTarget = !_IsRotationTarget;
         _RotationF = _IsRotationTarget ? RotationTarget : _StoredRotation;
     }
 }