Exemple #1
0
            public static void BuildWall(string effectName, string spellId, float wallLength, float lifeTime, float enlargeTime, float secondsDelayStart, float shrinkTime, float rotation, float distanceBetweenWallEffectsFeet = 2.5f)
            {
                List <Vector3> handles = null;

                List <LineRulerMode> allLineRulers = Rulers.GetAllLineRulers();

                if (!allLineRulers.Any())
                {
                    Log.Error($"BuildWall: No line rulers!!!");
                    return;
                }

                LineRulerMode LineRulerMode = allLineRulers.First();

                if (LineRulerMode == null)
                {
                    Log.Error($"LineRulerMode == null");
                    return;
                }

                handles = LineRulerMode.GetPositions();

                if (handles == null)
                {
                    Log.Error($"handles not found!");
                    return;
                }
                else
                {
                    Log.Debug($"Found {handles.Count} ruler handles!!!");
                }
                BuildWallSegments(effectName, spellId, wallLength, lifeTime, enlargeTime, secondsDelayStart, shrinkTime, rotation, distanceBetweenWallEffectsFeet, handles);
            }
Exemple #2
0
    /// <summary>
    /// 玩家请求出牌
    /// </summary>
    private void onPlayerPlayCard()
    {
        List <Card> cardList = CharacterView.Player.FindSelectCard();
        CardType    cardType;

        Rulers.CanPop(cardList, out cardType);

        //!#@!#!@$!@#!@$!@%!@#
        //还需要根据上一次的出牌类型

        if (cardType != CardType.None)
        {
            //可以出牌
            PlayCardArgs e = new PlayCardArgs()
            {
                cardType      = cardType,
                characterType = CharacterType.Player,
                Length        = cardList.Count,
                Weight        = Tools.GetWeight(cardList, cardType)
            };
            dispatcher.Dispatch(CommandEvent.PlayCard, e);
        }
        else
        {
            UnityEngine.Debug.Log("请选择正确的牌");
        }
    }
Exemple #3
0
        public void RegisterActions(Gtk.Application app, GLib.Menu menu)
        {
            var zoom_section = new GLib.Menu();

            menu.AppendSection(null, zoom_section);

            app.AddAccelAction(ZoomIn, new[] { "<Primary>plus", "<Primary>equal", "equal", "<Primary>KP_Add", "KP_Add" });
            zoom_section.AppendItem(ZoomIn.CreateMenuItem());

            app.AddAccelAction(ZoomOut, new[] { "<Primary>minus", "<Primary>underscore", "minus", "<Primary>KP_Subtract", "KP_Subtract" });
            zoom_section.AppendItem(ZoomOut.CreateMenuItem());

            app.AddAccelAction(ActualSize, new[] { "<Primary>0", "<Primary><Shift>A" });
            zoom_section.AppendItem(ActualSize.CreateMenuItem());

            app.AddAccelAction(ZoomToWindow, "<Primary>B");
            zoom_section.AppendItem(ZoomToWindow.CreateMenuItem());

            app.AddAccelAction(Fullscreen, "F11");
            zoom_section.AppendItem(Fullscreen.CreateMenuItem());

            var metric_section = new GLib.Menu();

            menu.AppendSection(null, metric_section);

            var metric_menu = new GLib.Menu();

            metric_section.AppendSubmenu(Translations.GetString("Ruler Units"), metric_menu);

            app.AddAction(RulerMetric);
            metric_menu.Append(Translations.GetString("Pixels"), $"app.{RulerMetric.Name}(0)");
            metric_menu.Append(Translations.GetString("Inches"), $"app.{RulerMetric.Name}(1)");
            metric_menu.Append(Translations.GetString("Centimeters"), $"app.{RulerMetric.Name}(2)");

            var show_hide_section = new GLib.Menu();

            menu.AppendSection(null, show_hide_section);

            var show_hide_menu = new GLib.Menu();

            show_hide_section.AppendSubmenu(Translations.GetString("Show/Hide"), show_hide_menu);

            app.AddAction(PixelGrid);
            show_hide_menu.AppendItem(PixelGrid.CreateMenuItem());

            app.AddAction(Rulers);
            show_hide_menu.AppendItem(Rulers.CreateMenuItem());

            app.AddAction(ToolBar);
            show_hide_menu.AppendItem(ToolBar.CreateMenuItem());

            app.AddAction(StatusBar);
            show_hide_menu.AppendItem(StatusBar.CreateMenuItem());

            app.AddAction(ToolBox);
            show_hide_menu.AppendItem(ToolBox.CreateMenuItem());

            app.AddAction(ImageTabs);
            show_hide_menu.AppendItem(ImageTabs.CreateMenuItem());
        }
Exemple #4
0
        public void CreateMainMenu(Gtk.Menu menu)
        {
            MenuItem show_pad = (MenuItem)menu.Children[0];

            menu.Remove(show_pad);

            menu.Append(ToolBar.CreateMenuItem());
            menu.Append(PixelGrid.CreateMenuItem());
            menu.Append(Rulers.CreateMenuItem());
            menu.Append(ImageTabs.CreateMenuItem());
            menu.AppendSeparator();

            ImageMenuItem zoomin = ZoomIn.CreateAcceleratedMenuItem(Gdk.Key.plus, Gdk.ModifierType.ControlMask);

            zoomin.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.equal, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
            zoomin.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.equal, 0, AccelFlags.Visible));
            zoomin.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.KP_Add, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
            zoomin.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.KP_Add, 0, AccelFlags.Visible));
            menu.Append(zoomin);

            ImageMenuItem zoomout = ZoomOut.CreateAcceleratedMenuItem(Gdk.Key.minus, Gdk.ModifierType.ControlMask);

            zoomout.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.minus, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
            zoomout.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.minus, 0, AccelFlags.Visible));
            zoomout.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.KP_Subtract, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
            zoomout.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.KP_Subtract, 0, AccelFlags.Visible));
            menu.Append(zoomout);

            ImageMenuItem actualsize = ActualSize.CreateAcceleratedMenuItem(Gdk.Key.Key_0, Gdk.ModifierType.ControlMask);

            actualsize.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.A, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask, AccelFlags.Visible));
            menu.Append(actualsize);
            menu.Append(ZoomToWindow.CreateAcceleratedMenuItem(Gdk.Key.B, Gdk.ModifierType.ControlMask));
            //menu.Append (ZoomToSelection.CreateAcceleratedMenuItem (Gdk.Key.B, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask));
            menu.Append(Fullscreen.CreateAcceleratedMenuItem(Gdk.Key.F11, Gdk.ModifierType.None));

            menu.AppendSeparator();

            Gtk.Action unit_action = new Gtk.Action("RulerUnits", Mono.Unix.Catalog.GetString("Ruler Units"), null, null);
            Menu       unit_menu   = (Menu)menu.AppendItem(unit_action.CreateSubMenuItem()).Submenu;

            unit_menu.Append(Pixels.CreateMenuItem());
            unit_menu.Append(Inches.CreateMenuItem());
            unit_menu.Append(Centimeters.CreateMenuItem());

            menu.AppendSeparator();
            menu.Append(show_pad);
        }
Exemple #5
0
 public Project(string citprojPath)
 {
     CitprojPath = citprojPath;
     AddDefaultRulers();
     UserprefsPath   = Path.ChangeExtension(citprojPath, ".userprefs");
     AssetsDirectory = Path.Combine(Path.GetDirectoryName(CitprojPath), "Data");
     if (!Directory.Exists(AssetsDirectory))
     {
         throw new InvalidOperationException($"Assets directory {AssetsDirectory} doesn't exist.");
     }
     Orange.The.Workspace.Open(citprojPath);
     foreach (var ruler in Orange.The.Workspace.ProjectJson.GetArray("Rulers", new RulerData[0]))
     {
         Rulers.Add(ruler);
     }
     UpdateTextureParams();
 }
    /// <summary>
    /// 玩家出牌的类型
    /// </summary>
    /// <param name="payload"></param>
    private void OnPlayerPlayCard()
    {
        List <Card> cardsList = characterView.m_player.FindCards();//获取被选中牌的集合
        CardType    pcardType;

        if (Rulers.CanPOp(cardsList, out pcardType))//判断能否出牌,并返回出牌的类型
        {
            //把数据封装,让外界处理选择牌能否出成功
            PlayCardArgs play = new PlayCardArgs()
            {
                characterType = CharacterType.Player,
                length        = cardsList.Count,
                weight        = ToolsManager.GetWeight(cardsList, pcardType),
                cardType      = pcardType
            };
            dispatcher.Dispatch(CommandEvent.PlayCard, play);//派发判断能否出牌成功的命令
        }
    }
Exemple #7
0
        public ZWPictureBox()
        {
            // enable double buffering
            this.SetStyle(ControlStyles.UserPaint |
                          ControlStyles.AllPaintingInWmPaint |
                          ControlStyles.OptimizedDoubleBuffer, true);
            this.laser        = new FixedLaser(this);
            rulers            = new Rulers(this);
            listViewItemArray = new ListViewItemArray();
            GraphicsList      = new GraphicsList();
            this.GraphicsList.DrawObjsChanged += GraphicsList_DrawObjsChanged;

            Initialize();
            InitializeControls();
            InitializeImageTracker();

            this.PictureBoxPaintedEvent += imageTracker.OnPicturePainted;
        }
    /// <summary>
    /// 请求玩家出牌事件的回调
    /// </summary>
    /// <param name="payload"></param>
    private void onPlayPayCard(IEvent payload)
    {
        List <Card> cardList = characterView.player.FindSelectCard();
        CardType    cardType;

        Rulers.CanPop(cardList, out cardType);
        //还需要根据上次出牌的类型



        if (cardType != CardType.None)
        {
            //可以出牌
            PlayCardArg e = new PlayCardArg(cardList.Count, Toos.GetWeight(cardList, cardType), CharacterType.Player, cardType);


            dispatcher.Dispatch(CommandEvent.PlayCard, e);
        }
        else
        {
            Debug.Log("请选择正确的牌");
        }
    }
 public void SaveActiveRuler()
 {
     Rulers.Add(ActiveRuler);
     ActiveRuler = new Ruler();
     UserPreferences.Instance.Save();
 }
Exemple #10
0
 public void RemoveRuler(RulerData ruler)
 {
     Orange.The.Workspace.ProjectJson.RemoveFromArray("Rulers", ruler);
     Rulers.Remove(ruler);
     Orange.The.Workspace.SaveCurrentProject();
 }
Exemple #11
0
 public void AddRuler(RulerData ruler)
 {
     Orange.The.Workspace.ProjectJson.AddToArray("Rulers", ruler);
     Rulers.Add(ruler);
     Orange.The.Workspace.SaveCurrentProject();
 }