Exemple #1
0
        public static String CreateNew(String title, String subtitle, String message, int width, int height)
        {
            Popup popup = new Popup(title, width, height);

            TextPanel kcPanel = new TextPanel(
                message,
                width - 10,
                height - 10,
                new int[] { 0, 0, 0 },
                new int[] { 0xBE, 0xBC, 0xFB },
                "pics/layout/bg_trend.png",
                -1,
                Location.CENTER
                );

            AddNewStyle(popup, subtitle, kcPanel, new List <IComponent>()
            {
                new Button("     OK     ", Location.CENTER)
                {
                    Colored    = true,
                    Styled     = true,
                    Close      = true,
                    FontSize   = 16,
                    FontWeight = 'b'
                }
            });

            return(popup.ToString());
        }
Exemple #2
0
        public ItemInventory(ItemScreen ui, UiSkinComponent skin, Texture2D texture, int x, int y, int width, int height, float sourceScale) : base(texture, x, y, width, height, sourceScale)
        {
            _itemui       = ui;
            TopRect       = new UiRectangle(this, skin.GetSkin("test"), PanelExt.SizeToBounds(Bounds, 0f, 0f, 1f, 0.1f), 0.5f);
            TopRect.Color = Microsoft.Xna.Framework.Color.Silver;


            _itemText = new TextPanel(this, ui.ParantMenu.StandardFont, "Item", TextSortMode.LEFT)
            {
                Color    = Color.Black,
                Position = PanelExt.PositionToBounds(TopRect.Bounds, 0.05f, 0.5f)
            };


            PanelGrid = new GridPanel(this, 4, 4, PanelExt.SizeToBounds(Bounds, 0f, 0.1f, 1f, 0.9f), 10, 10);
            for (int i = 0; i < 16; i++)
            {
                PanelGrid.AddGridChilde(new UiRectangle(skin.GetSkin("item"), new Rectangle(0, 0, 100, 100), 2)
                {
                    PanelCode = i
                });
            }

            _exit = new ImagePanel(this, "UI\\exit");
            _exit.SetPosition(PanelExt.PositionToBounds(Bounds, 0.95f, 0.05f));
            _exit.Scale = 1.5f;
            _exit.Recalculate();

            SelectOnEvent += ItemPanel_SelectOnEvent;
        }
Exemple #3
0
    //显示文字框
    public void showSpecialTextPanel(Component _object, string text, Vector2 pos, AudioClip se = null, float p = 1.0f)
    {
        AudioClip s;

        if (se == null)
        {
            s = show;
        }
        else
        {
            s = se;
        }

        textRequest = _object;
        if (textPanel)
        {
            Destroy(textPanel.gameObject);
        }
        GameObject go = GameObject.Instantiate(SpecialTextPanel) as GameObject;

        textPanel = go.GetComponent <TextPanel>();
        go.transform.SetParent(GameObject.Find("Canvas").GetComponent <RectTransform>());
        go.transform.localPosition = pos;
        gameManager.instance.changeState(nowState.text, textPanel.gameObject);

        showFinish = false;
        if (s)
        {
            gameManager.instance.playSE(s, p, true);
        }
        StartCoroutine(showText(text, 0.05f, s, p));
    }
 public override void UpdateData()
 {
     this.panel2.Controls.Clear();
     this.doubleBufferPanel1.Width = panel2.Width - 40;
     this.panel2.Controls.Add(this.doubleBufferPanel1);
     this.panel2.Controls.Add(this.label2);
     if (SelectedItem != null)
     {
         if (SelectedItem.TagLines.IsNonEmpty())
         {
             label2.Visible = false;
             int index = 0;
             foreach (string text in SelectedItem.TagLines)
             {
                 TextPanel panel = new TextPanel();
                 panel.Location = new Point(20, 40 + (index * 30));
                 panel.Size = new Size(panel2.Width - 40, 30);
                 panel.text = text;
                 panel.index = index;
                 panel.OnMouseDownEvent += new MouseEventHandler(panel_OnMouseDownEvent);
                 panel.OnMouseMoveEvent += new MouseEventHandler(panel_OnMouseMoveEvent);
                 panel.OnMouseUpEvent += new MouseEventHandler(panel_OnMouseUpEvent);
                 panel.OnTextChange += new EventHandler(panel_OnTextChanged);
                 panel.OnTextDelete += new EventHandler(panel_OnTextDelete);
                 this.panel2.Controls.Add(panel);
                 index++;
             }
         }
         else
         {
             label2.Visible = true;
         }
     }
 }
        public void Main(string argument)
        {
            TAG = (argument.Trim().Length > 0) ? argument : TAG;
            IMyShipController       OriginCockpit  = findPilotedCockpit();
            Vector3D                origin         = (OriginCockpit != null) ? OriginCockpit.GetPosition() : Me.GetPosition();
            List <IMyRemoteControl> RemoteControls = new List <IMyRemoteControl>();
            List <IMyTextPanel>     TextPanels     = new List <IMyTextPanel>();

            GridTerminalSystem.GetBlocksOfType <IMyRemoteControl>(RemoteControls, (x => x.CubeGrid.Equals(Me.CubeGrid) && x.CustomName.Contains(TAG)));
            GridTerminalSystem.GetBlocksOfType <IMyTextPanel>(TextPanels, (x => x.CubeGrid.Equals(Me.CubeGrid) && x.CustomName.Contains(TAG)));
            if (TextPanels.Count > 0 && RemoteControls.Count > 0)
            {
                StringBuilder Distances = new StringBuilder();
                foreach (IMyRemoteControl RemoteControl in RemoteControls)
                {
                    List <MyWaypointInfo> Waypoints = new List <MyWaypointInfo>();
                    RemoteControl.GetWaypointInfo(Waypoints);
                    foreach (MyWaypointInfo Waypoint in Waypoints)
                    {
                        Distances.AppendLine(formatDistance(Vector3D.Distance(origin, Waypoint.Coords)) + ": " + Waypoint.Name);
                    }
                }
                foreach (IMyTextPanel TextPanel in TextPanels)
                {
                    TextPanel.WritePublicText(((TextPanel.GetPublicTitle().Trim().Length > 0)? TextPanel.GetPublicTitle().Trim() + "\n":"") + Distances.ToString());
                    TextPanel.ShowPublicTextOnScreen();
                }
            }
        }
Exemple #6
0
 public TerminalManager(Program program)
 {
     this.program   = program;
     ShipController = new ShipController(program);
     TextPanel      = new TextPanel(program);
     //Antenna = new Antenna(program);
     cycle = SetCycle();
 }
        /// <summary>
        /// Adds a new text status panel</summary>
        /// <param name="width">Text status panel width</param>
        /// <returns>Text panel</returns>
        public IStatusText AddText(int width)
        {
            TextPanel textPanel = new TextPanel(width);

            textPanel.Name = "$Status" + (s_controlCount++);
            m_statusStrip.Items.Add(textPanel);
            return(textPanel);
        }
        public bool InitializeApplication(Form1 topLevelForm, CaptureDevice i_cap_device)
        {
            topLevelForm.ClientSize = new Size(SCREEN_WIDTH, SCREEN_HEIGHT);
            //キャプチャを作る(QVGAでフレームレートは30)
            i_cap_device.SetCaptureListener(this);
            i_cap_device.PrepareCapture(SCREEN_WIDTH, SCREEN_HEIGHT, 30);
            this._cap = i_cap_device;

            //ARラスタを作る(DirectShowキャプチャ仕様)。
            this._raster = new DsRgbRaster(i_cap_device.video_width, i_cap_device.video_height);

            //AR用カメラパラメタファイルをロードして設定
            NyARParam ap = NyARParam.loadFromARParamFile(File.OpenRead(AR_CAMERA_FILE), SCREEN_WIDTH, SCREEN_HEIGHT);

            //Direct3d用のユーティリティ準備

            //プロセッサの準備
            this._processor = new MarkerProcessor(ap, this._raster.getBufferType());
            NyARCode[] codes = new NyARCode[2];
            codes[0] = NyARCode.loadFromARPattFile(File.OpenRead(AR_CODE_FILE1), 16, 16);
            codes[1] = NyARCode.loadFromARPattFile(File.OpenRead(AR_CODE_FILE2), 16, 16);
            this._processor.setARCodeTable(codes, 16, 80.0);


            //3dデバイスを準備する
            this._device = PrepareD3dDevice(topLevelForm);
            this._device.RenderState.ZBufferEnable = true;
            this._device.RenderState.Lighting      = false;
            this._device.RenderState.CullMode      = Cull.CounterClockwise;

            Viewport vp = new Viewport();

            vp.X      = 0;
            vp.Y      = 0;
            vp.Height = ap.getScreenSize().h;
            vp.Width  = ap.getScreenSize().w;
            vp.MaxZ   = 1.0f;
            //ビューポート設定
            this._device.Viewport = vp;

            this._text = new TextPanel(this._device, 1);
            //カメラProjectionの設定
            Matrix tmp = new Matrix();

            NyARD3dUtil.toCameraFrustumRH(ap.getPerspectiveProjectionMatrix(), ap.getScreenSize(), 1, 10, 10000, ref tmp);
            this._device.Transform.Projection = tmp;

            // ビュー変換の設定(左手座標系ビュー行列で設定する)
            // 0,0,0から、Z+方向を向いて、上方向がY軸
            this._device.Transform.View = Matrix.LookAtLH(
                new Vector3(0.0f, 0.0f, 0.0f), new Vector3(0.0f, 0.0f, 1.0f), new Vector3(0.0f, 1.0f, 0.0f));

            //背景サーフェイスを作成
            this._surface = new NyARD3dSurface(this._device, SCREEN_WIDTH, SCREEN_HEIGHT);

            return(true);
        }
Exemple #9
0
    public void InfoChange(Product product, GameObject parentPanel)
    {
        this.product     = product;
        this.parentPanel = parentPanel;

        TextPanel textPanel = transform.GetChild(0).GetComponent <TextPanel>();

        textPanel.Change(product.name);
    }
Exemple #10
0
 // Use this for initialization
 void Awake()
 {
     gameOptions = GameObject.FindGameObjectWithTag("Player").GetComponent <GameOptions>();
     inventory   = GameObject.FindGameObjectWithTag("Inventory").GetComponent <Inventory>();
     database    = GameObject.FindGameObjectWithTag("ItemDatabase").GetComponent <ItemDatabase>();
     infoPanel   = GameObject.FindGameObjectWithTag("InfoPanel").GetComponent <InfoPanel>();
     textPanel   = GameObject.FindGameObjectWithTag("TextPanel").GetComponent <TextPanel>();
     this.gameObject.SetActive(false);
 }
Exemple #11
0
        /// <summary>
        /// Scripts that use UpdateManager shall be added here.
        /// </summary>
        private void RegisterScripts()
        {
            RegisterForBlock(typeof(MyObjectBuilder_Beacon), (IMyCubeBlock block) =>
            {
                Beacon newBeacon = new Beacon(block);
                RegisterForUpdates(100, newBeacon.UpdateAfterSimulation100, block);
            });
            RegisterForBlock(typeof(MyObjectBuilder_TextPanel), (IMyCubeBlock block) =>
            {
                TextPanel newTextPanel = new TextPanel(block);
                RegisterForUpdates(100, newTextPanel.UpdateAfterSimulation100, block);
            });
            RegisterForBlock(typeof(MyObjectBuilder_LaserAntenna), (IMyCubeBlock block) =>
            {
                LaserAntenna newLA = new LaserAntenna(block);
                RegisterForUpdates(100, newLA.UpdateAfterSimulation100, block);
            });
            RegisterForBlock(typeof(MyObjectBuilder_MyProgrammableBlock), (IMyCubeBlock block) =>
            {
                ProgrammableBlock newPB = new ProgrammableBlock(block);
                RegisterForUpdates(100, newPB.UpdateAfterSimulation100, block);
            });
            RegisterForBlock(typeof(MyObjectBuilder_RadioAntenna), (IMyCubeBlock block) =>
            {
                RadioAntenna newRA = new RadioAntenna(block);
                RegisterForUpdates(100, newRA.UpdateAfterSimulation100, block);
            });
            RegisterForBlock(typeof(MyObjectBuilder_RemoteControl), (IMyCubeBlock block) =>
            {
                RemoteControl newRC = new RemoteControl(block);
                // Does not receive Updates
            });

            RegisterForBlock(typeof(MyObjectBuilder_LargeGatlingTurret), (IMyCubeBlock block) =>
            {
                TurretLargeGatling newTurret = new TurretLargeGatling(block);
                RegisterForUpdates(1, newTurret.UpdateAfterSimulation, block);
            });
            RegisterForBlock(typeof(MyObjectBuilder_LargeMissileTurret), (IMyCubeBlock block) =>
            {
                TurretLargeRocket newTurret = new TurretLargeRocket(block);
                RegisterForUpdates(1, newTurret.UpdateAfterSimulation, block);
            });
            RegisterForBlock(typeof(MyObjectBuilder_InteriorTurret), (IMyCubeBlock block) =>
            {
                TurretInterior newTurret = new TurretInterior(block);
                RegisterForUpdates(1, newTurret.UpdateAfterSimulation, block);
            });

            //RegisterForBlock(typeof(MyObjectBuilder_OreDetector), (IMyCubeBlock block) =>
            //	{
            //		OreDetector newOD = new OreDetector(block);
            //		RegisterForUpdates(100, newOD.Update100, block);
            //	});
        }
Exemple #12
0
        public UiDiscardDialog(GameObject obj)
        {
            Content    = new TextPanel(obj.GetChild(0));
            Background = new FrameBackground(obj.GetChild(1));
            Panel      = obj.GetExactComponent <UIPanel>();

            if (Configuration.TetraMaster.DiscardAutoButton)
            {
                AddAutoButton();
            }
        }
Exemple #13
0
        private void GetActions(IEnumerable <ACommand> commandList, AutopilotActionList actionList)
        {
            int       count = 0;
            const int limit = 1000;

            foreach (ACommand cmd in commandList)
            {
                TextPanel tp = cmd as TextPanel;
                if (tp == null)
                {
                    if (cmd.Action == null)
                    {
                        Logger.AlwaysLog("Command is missing action: " + cmd.DisplayString, Logger.severity.ERROR);
                        continue;
                    }

                    if (++count > limit)
                    {
                        Logger.DebugLog("Reached command limit");
                        m_syntaxErrors.AppendLine("Reached command limit");
                        return;
                    }
                    Logger.DebugLog("yield: " + cmd.DisplayString);
                    actionList.Add(cmd.Action);
                    continue;
                }

                TextPanelMonitor textPanelMonitor = tp.GetTextPanelMonitor(m_block, this);
                if (textPanelMonitor == null)
                {
                    Logger.DebugLog("Text panel not found: " + tp.SearchPanelName);
                    m_syntaxErrors.Append("Text panel not found: ");
                    m_syntaxErrors.AppendLine(tp.SearchPanelName);
                    continue;
                }
                if (textPanelMonitor.AutopilotActions.IsEmpty)
                {
                    Logger.DebugLog(textPanelMonitor.TextPanel.DisplayNameText + " has no commands");
                    m_syntaxErrors.Append(textPanelMonitor.TextPanel.DisplayNameText);
                    m_syntaxErrors.AppendLine(" has no commands");
                    continue;
                }

                actionList.Add(textPanelMonitor);
            }

            actionList.Reset();
        }
Exemple #14
0
 private void InitializeComponent()
 {
     ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof (TaskTrayBalloonPanel));
       this.MessageTextPanel = new TextPanel();
       this.SuspendLayout();
       this.MessageTextPanel.Alignment = StringAlignment.Near;
       this.MessageTextPanel.BackColor = Color.White;
       componentResourceManager.ApplyResources((object) this.MessageTextPanel, "MessageTextPanel");
       this.MessageTextPanel.Name = "MessageTextPanel";
       this.AutoScaleMode = AutoScaleMode.None;
       this.BackColor = Color.White;
       this.Controls.Add((Control) this.MessageTextPanel);
       componentResourceManager.ApplyResources((object) this, "$this");
       this.Name = "TaskTrayBalloonPanel";
       this.ResumeLayout(false);
 }
Exemple #15
0
        public override void Awake()
        {
            base.Awake();

            var t = controller.transform;

            ListCtrl     = t.GetMonoILRComponent <LTHeroBattleListCtrl>("CenterBG");
            awardView    = t.GetMonoILRComponent <LTHeroBattleAwardView>("LTHeroBattleAwardView");
            RuleBtn      = t.GetComponent <UIButton>("LeftTopHold/RuleBtn");
            RewardBtn    = t.GetComponent <UIButton>("RightTopHold/Reward_Button");
            ShopBtn      = t.GetComponent <UIButton>("RightTopHold/Shop_Button");
            StarLabel    = t.GetComponent <UILabel>("LeftTopHold/Cup/Star_Label");
            SuccProgress = t.GetComponent <UIProgressBar>("LeftTopHold/Cup/WinProgressBar");
            SuccLabel    = t.GetComponent <UILabel>("LeftTopHold/Cup/WinProgressBar/Progress_Label");
            CostProgress = t.GetComponent <UIProgressBar>("LeftTopHold/Cup/CostProgressBar");
            CostLabel    = t.GetComponent <UILabel>("LeftTopHold/Cup/CostProgressBar/Progress_Label");
            HasGetTip    = t.FindEx("LeftTopHold/Cup/RewardRoot/HasGetTip").gameObject;
            ItemRoot     = t.GetComponent <UIGrid>("LeftTopHold/Cup/RewardRoot/RewardGrid");
            ItemPrefab   = t.GetMonoILRComponent <LTShowItem>("LeftTopHold/Cup/RewardRoot/RewardGrid/LTShowItem");
            UIButton backButton = t.GetComponent <UIButton>("UINormalFrameBG/CancelBtn");

            backButton.onClick.Add(new EventDelegate(OnCancelButtonClick));
            RuleBtn.onClick.Add(new EventDelegate(OnRuleBtnClick));
            RewardBtn.onClick.Add(new EventDelegate(OnRewardBtnClick));
            ShopBtn.onClick.Add(new EventDelegate(OnShopBtnClick));
            RewardItemList = new List <LTShowItem>();

            cupUITexture = t.GetComponent <UITexture>("LeftTopHold/Cup");
            if (controller.ObjectParamList != null)
            {
                CupTextures = new Texture[controller.ObjectParamList.Count];
                for (int i = 0; i < controller.ObjectParamList.Count; i++)
                {
                    CupTextures[i] = (Texture)controller.ObjectParamList[i];
                }
            }

            TextPanel = t.FindEx("Text").gameObject;
            DescLabel = t.GetComponent <UILabel>("Text/TextLabel");
            t.GetComponent <UIEventTrigger>("Text/Bg").onClick.Add(new EventDelegate(() =>
            {
                TextPanel.CustomSetActive(false);
            }));
            TextPanel.gameObject.CustomSetActive(false);
            Messenger.AddListener <int>(EventName.HeroBattleUpdateUI, UpdateUI);
            Messenger.AddListener <string>(EventName.HeroBattleShowDesc, ShowDescPanel);
        }
Exemple #16
0
 public ErrorPanel(ErrorDialog parentDialog, string errorMessage, string details, string helpTopic)
 {
     this._parentDialog = parentDialog;
       this._helpTopic = helpTopic;
       if (this._textPanel == null)
       {
     this._textPanel = new TextPanel();
     this._textPanel.Location = new Point(74, 30);
     this._textPanel.Size = new Size(261, 72);
     this._textPanel.TabStop = false;
     this.Controls.Add((Control) this._textPanel);
       }
       this.InitializeComponent();
       this._origProblemImageLocation = this.ErrorPanel_ProblemImage.Location;
       this._origErrorMsgLblLocation = this._textPanel.Location;
       this.CustomInitializeComponents(errorMessage, details);
       this.ErrorPanel_ProblemImage.Image = (Image) ScalingUtils.ScaleBitmap(this.ErrorPanel_ProblemImage.Image);
 }
Exemple #17
0
 //隐藏文字框
 public void hideTextPanel()
 {
     if (textPanel != null)
     {
         if (textPanel.gameObject.tag == "specialText")
         {
             Destroy(textPanel.gameObject);
             textPanel = null;
         }
         else
         {
             textPanel.gameObject.SetActive(false);
         }
         gameManager.instance.changeState(nowState.move);
     }
     showFinish = false;
     canHide    = false;
 }
Exemple #18
0
    //显示文字框
    public void showTextPanel(Component _object, string name, string text, Sprite sprite, AudioClip se = null, float p = 1.0f, bool _new = false)
    {
        AudioClip s;

        if (se == null)
        {
            s = show;
        }
        else
        {
            s = se;
        }
        textRequest = _object;
        if (textPanel == null)
        {
            GameObject go = GameObject.Instantiate(TextPanel) as GameObject;
            textPanel = go.GetComponent <TextPanel>();
            go.transform.SetParent(GameObject.Find("Canvas").GetComponent <RectTransform>());
            go.transform.localPosition = Vector2.zero;
        }
        else if (_new)
        {
            Destroy(textPanel.gameObject);
            GameObject go = GameObject.Instantiate(TextPanel) as GameObject;
            textPanel = go.GetComponent <TextPanel>();
            go.transform.SetParent(GameObject.Find("Canvas").GetComponent <RectTransform>());
            go.transform.localPosition = Vector2.zero;
        }
        else
        {
            textPanel.gameObject.SetActive(true);
            textPanel.changeSize();
        }
        gameManager.instance.changeState(nowState.text, textPanel.gameObject);
        textPanel.setNameText(name);
        textPanel.setAvator(sprite);
        showFinish = false;
        if (s)
        {
            gameManager.instance.playSE(s, p, true);
        }
        StartCoroutine(showText(text, 0.05f, s, p));
    }
Exemple #19
0
        public MenuState(Main game, GraphicsDevice graphicsDevice, ContentManager content, GameStateManager stateManager) : base(game, graphicsDevice, content, stateManager)
        {
            game.IsMouseVisible = true;

            Texture2D buttonTexture = _content.Load <Texture2D>("Controls/red_button13");

            SpriteFont buttonFont = _content.Load <SpriteFont>("Fonts/Western");

            SpriteFont titleFont = _content.Load <SpriteFont>("Fonts/WesternTitle");

            var titleText = new TextPanel(titleFont)
            {
                Position = new Vector2(graphicsDevice.PresentationParameters.BackBufferWidth / 2 - 115, 50),
                Text     = "BIG IRON",
            };

            var startGame = new Button(buttonTexture, buttonFont)
            {
                Position = new Vector2(300, 200),
                Text     = "Start Game",
            };

            var quitGame = new Button(buttonTexture, buttonFont)
            {
                Position = new Vector2(300, 300),
                Text     = "Quit Game",
            };

            startGame.Click += StartGame_Click;
            quitGame.Click  += QuitGame_Click;

            _components = new List <Component>
            {
                startGame,
                quitGame,
                titleText,
            };
        }
Exemple #20
0
    IEnumerator TokenPlacementPrompt(IEnumerable <Tuple <int, Vector3[]> > explored)
    {
        Debug.Log("**START TokenPlacementPrompt");

        foreach (Tuple <int, Vector3[]> t in explored)         //each tile...
        {
            bool waiting = true;
            Debug.Log($"Tokens in tile {t.Item1}: {t.Item2.Length}");

            foreach (Vector3 v in t.Item2)              //each token...
            {
                FindObjectOfType <CamControl>().MoveTo(v);
                TextPanel p = FindObjectOfType <InteractionManager>().GetNewTextPanel();
                p.ShowOkContinue("Place the indicated Token on Tile " + t.Item1 + ".", ButtonIcon.Continue, () => waiting = false);
                while (waiting)
                {
                    yield return(null);
                }
            }
        }

        Debug.Log("**END TokenPlacementPrompt");
    }
Exemple #21
0
        public StatusScreen(Data data, PlayUI parant) : base(data, parant)
        {
            HpBar     = new BarHp(data, this);
            AirBar    = new BarAir(data, this);
            MentalBar = new BarMental(data, this);
            ExtBar    = new BarExp(data, this);

            _Uiclass = new UiRectangle(ParantMenu.UISkin.GetSkin("test"), new Rectangle(ExtBar.Bounds.Left - 200, ExtBar.Bounds.Bottom - 100, 200, 100), 0.5f);
            AddSprite(_Uiclass);

            ClassName = new TextPanel(_Uiclass, parant.StandardFont, "Class", TextSortMode.MIDDLE)
            {
                Position = PanelExt.PositionToBounds(_Uiclass.Bounds, 0.5f, 0.5f),
            };


            _CraftMode = new UiRectangle(ParantMenu.UISkin.GetSkin("test"), new Rectangle(ExtBar.Bounds.Right, ExtBar.Bounds.Bottom - 100, 200, 100), 0.5f);
            AddSprite(_CraftMode);

            new TextPanel(_CraftMode, parant.StandardFont, "CraftMode", TextSortMode.MIDDLE)
            {
                Position = PanelExt.PositionToBounds(_CraftMode.Bounds, 0.5f, 0.5f),
            };
        }
Exemple #22
0
        /// <summary>
        /// Scripts that use UpdateManager and run on clients as well as on server shall be added here.
        /// </summary>
        private void RegisterScripts_ClientAndServer()
        {
            #region Attached

            RegisterForBlock(new MyObjectBuilderType[] { typeof(MyObjectBuilder_MotorStator), typeof(MyObjectBuilder_MotorAdvancedStator), typeof(MyObjectBuilder_MotorSuspension) },
                             block => RegisterForUpdates(100, (new StatorRotor.Stator(block)).Update, block));

            RegisterForBlock(typeof(MyObjectBuilder_ExtendedPistonBase), (block) => {
                Piston.PistonBase pistonBase = new Piston.PistonBase(block);
                RegisterForUpdates(100, pistonBase.Update, block);
            });

            RegisterForBlock(typeof(MyObjectBuilder_ShipConnector), (block) => {
                Connector conn = new Connector(block);
                RegisterForUpdates(10, conn.Update, block);
            });

            RegisterForBlock(typeof(MyObjectBuilder_LandingGear), (block) => {
                if (!Hacker.IsHacker(block))
                {
                    new LandingGear(block);
                }
            });

            #endregion

            #region Antenna Communication

            Action <IMyCubeBlock> nodeConstruct = block => {
                RelayNode node = new RelayNode(block);
                RegisterForUpdates(100, node.Update100, block);
            };

            RegisterForBlock(typeof(MyObjectBuilder_Beacon), nodeConstruct);
            RegisterForBlock(typeof(MyObjectBuilder_LaserAntenna), nodeConstruct);
            RegisterForBlock(typeof(MyObjectBuilder_RadioAntenna), nodeConstruct);

            RegisterForCharacter(character => {
                if (character.IsPlayer)
                {
                    RelayNode node = new RelayNode(character);
                    RegisterForUpdates(100, node.Update100, (IMyEntity)character);
                }
            });

            RegisterForBlock(typeof(MyObjectBuilder_MyProgrammableBlock), block => {
                ProgrammableBlock pb = new ProgrammableBlock(block);
                if (MyAPIGateway.Multiplayer.IsServer)
                {
                    RegisterForUpdates(100, pb.Update100, block);
                }
            });

            RegisterForBlock(typeof(MyObjectBuilder_TextPanel), block => {
                TextPanel tp = new TextPanel(block);
                if (MyAPIGateway.Multiplayer.IsServer)
                {
                    RegisterForUpdates(100, tp.Update100, block);
                }
            });

            RegisterForBlock(typeof(MyObjectBuilder_Projector), block => {
                Projector p = new Projector(block);
                if (MyAPIGateway.Session.Player != null)
                {
                    RegisterForUpdates(100, p.Update100, block);
                    RegisterForUpdates(1, p.Update1, block);
                }
            });

            if (MyAPIGateway.Session.Player != null)
            {
                new Player();
            }

            #endregion

            #region Autopilot

            if (!MyAPIGateway.Multiplayer.IsServer)
            {
                //RadarEquipment.Definition apRadar = new RadarEquipment.Definition()
                //{
                //	Radar = true,
                //	LineOfSight = false,
                //	MaxTargets_Tracking = 3,
                //	MaxPowerLevel = 1000
                //};

                Action <IMyCubeBlock> apConstruct = (block) => {
                    if (ShipAutopilot.IsAutopilotBlock(block))
                    {
                        nodeConstruct(block);
                        new AutopilotTerminal(block);
                        //RadarEquipment r = new RadarEquipment(block, apRadar, block);
                        //RegisterForUpdates(100, r.Update100, block);
                    }
                };

                if (ServerSettings.GetSetting <bool>(ServerSettings.SettingName.bUseRemoteControl))
                {
                    RegisterForBlock(typeof(MyObjectBuilder_RemoteControl), apConstruct);
                }
                RegisterForBlock(typeof(MyObjectBuilder_Cockpit), apConstruct);
            }

            if (ServerSettings.GetSetting <bool>(ServerSettings.SettingName.bAirResistanceBeta))
            {
                RegisterForGrid(grid => {
                    AeroEffects aero = new AeroEffects(grid);
                    RegisterForUpdates(1, aero.Update1, grid);
                    if (MyAPIGateway.Multiplayer.IsServer)
                    {
                        RegisterForUpdates(100, aero.Update100, grid);
                    }
                });
                RegisterForBlock(typeof(MyObjectBuilder_Cockpit), block => RegisterForUpdates(1, (new CockpitTerminal(block)).Update1, block));
            }

            #endregion

            #region Radar

            if (ServerSettings.GetSetting <bool>(ServerSettings.SettingName.bAllowRadar))
            {
                RegisterForBlock(typeof(MyObjectBuilder_Beacon), (block) => {
                    if (RadarEquipment.IsDefinedRadarEquipment(block))
                    {
                        new RadarEquipment(block);
                    }
                });
                RegisterForBlock(typeof(MyObjectBuilder_RadioAntenna), (block) => {
                    if (RadarEquipment.IsDefinedRadarEquipment(block))
                    {
                        new RadarEquipment(block);
                    }
                });
                RegisterForUpdates(100, RadarEquipment.UpdateAll);
            }

            #endregion

            #region Terminal Control

            RegisterForBlock(new MyObjectBuilderType[] { typeof(MyObjectBuilder_RadioAntenna), typeof(MyObjectBuilder_LaserAntenna) }, block => new ManualMessage(block));

            #endregion Terminal Control

            #region Weapon Control

            if (ServerSettings.GetSetting <bool>(ServerSettings.SettingName.bAllowWeaponControl))
            {
                #region Turrets

                Action <IMyCubeBlock> constructor;
                if (ServerSettings.GetSetting <bool>(ServerSettings.SettingName.bAllowGuidedMissile))
                {
                    constructor = block => {
                        if (!WeaponTargeting.ValidWeaponBlock(block))
                        {
                            return;
                        }
                        Turret t = new Turret(block);
                        RegisterForUpdates(1, t.Update_Targeting, block);
                        if (GuidedMissileLauncher.IsGuidedMissileLauncher(block))
                        {
                            GuidedMissileLauncher gml = new GuidedMissileLauncher(t);
                            RegisterForUpdates(1, gml.Update1, block);
                        }
                    }
                }
                ;
                else
                {
                    constructor = block => {
                        if (!WeaponTargeting.ValidWeaponBlock(block))
                        {
                            return;
                        }
                        Turret t = new Turret(block);
                        RegisterForUpdates(1, t.Update_Targeting, block);
                    }
                };

                RegisterForBlock(typeof(MyObjectBuilder_LargeGatlingTurret), constructor);
                RegisterForBlock(typeof(MyObjectBuilder_LargeMissileTurret), constructor);
                RegisterForBlock(typeof(MyObjectBuilder_InteriorTurret), constructor);

                #endregion

                #region Fixed

                if (ServerSettings.GetSetting <bool>(ServerSettings.SettingName.bAllowGuidedMissile))
                {
                    constructor = block => {
                        if (!WeaponTargeting.ValidWeaponBlock(block))
                        {
                            return;
                        }
                        FixedWeapon w = new FixedWeapon(block);
                        RegisterForUpdates(1, w.Update_Targeting, block);
                        if (GuidedMissileLauncher.IsGuidedMissileLauncher(block))
                        {
                            GuidedMissileLauncher gml = new GuidedMissileLauncher(w);
                            RegisterForUpdates(1, gml.Update1, block);
                        }
                    };
                }
                else
                {
                    constructor = block => {
                        if (!WeaponTargeting.ValidWeaponBlock(block))
                        {
                            return;
                        }
                        FixedWeapon w = new FixedWeapon(block);
                        RegisterForUpdates(1, w.Update_Targeting, block);
                    }
                };

                RegisterForBlock(typeof(MyObjectBuilder_SmallGatlingGun), constructor);
                RegisterForBlock(typeof(MyObjectBuilder_SmallMissileLauncher), constructor);
                RegisterForBlock(typeof(MyObjectBuilder_SmallMissileLauncherReload), constructor);

                #endregion

                // apparently missiles do not have their positions synced
                RegisterForUpdates(1, GuidedMissile.Update1);
                RegisterForUpdates(10, GuidedMissile.Update10);
                RegisterForUpdates(100, GuidedMissile.Update100);
            }
            else
            {
                Log.DebugLog("Weapon Control is disabled", Logger.severity.INFO);
            }

            #endregion

            #region Solar

            if (!MyAPIGateway.Multiplayer.IsServer)
            {
                RegisterForBlock(typeof(MyObjectBuilder_OxygenFarm), (block) => new Solar(block));
                RegisterForBlock(typeof(MyObjectBuilder_SolarPanel), (block) => new Solar(block));
            }

            #endregion

            new ChatHandler();
            Globals.Update100();
            RegisterForUpdates(100, Globals.Update100);

            Action <IMyCubeBlock> act = (block) => MainCockpitFix.AddController((IMyShipController)block);
            RegisterForBlock(typeof(MyObjectBuilder_Cockpit), act);
            RegisterForBlock(typeof(MyObjectBuilder_RemoteControl), act);
        }
Exemple #23
0
        public static void AddNewStyle(Popup popup, String subtitle, TextPanel kcPanel, List <IComponent> controls)
        {
            popup.background = new int[] { 255, 255, 255 };

            var framePaddingPanel = new Panel(new BorderLayout(), Location.CENTER);

            framePaddingPanel.AddComponent(new Panel(null, Location.EAST, "pics/layout/bg_trend.png", 1, 10));
            framePaddingPanel.AddComponent(new Panel(null, Location.WEST, "pics/layout/bg_trend.png", 1, 10));
            framePaddingPanel.AddComponent(new Panel(null, Location.NORTH, "-", 10, 1));
            framePaddingPanel.AddComponent(new Panel(null, Location.SOUTH, "-", 10, 1)
            {
                Background = new int[] { 235, 235, 255 }
            });

            popup.AddComponent(framePaddingPanel);

            var baseFramePanel = new Panel(new BorderLayout(), Location.CENTER);

            framePaddingPanel.AddComponent(baseFramePanel);

            #region Controls

            var southOuterGridPanel = new Panel(new GridLayout(1, 1, 1, 1), Location.SOUTH)
            {
                Background = new int[] { 235, 235, 255 }
            };
            baseFramePanel.AddComponent(southOuterGridPanel);

            var southFlowPanel = new Panel(new FlowLayout());
            southOuterGridPanel.AddComponent(southFlowPanel);

            var southGridPanel = new Panel(new GridLayout(0, 1, 1, 1));
            southFlowPanel.AddComponent(southGridPanel);

            foreach (var control in  controls)
            {
                var controlPanel = new Panel(new BorderLayout(), Location.NONE);
                southGridPanel.AddComponent(controlPanel);

                controlPanel.AddComponent(control);
            }

            #endregion

            var borderLayoutPanel = new Panel(new BorderLayout(), Location.NORTH);
            baseFramePanel.AddComponent(borderLayoutPanel);

            #region Header

            #region Header Top Border

            var northPanelOuter = new Panel(new BorderLayout(), Location.NORTH);
            borderLayoutPanel.AddComponent(northPanelOuter);

            var northPanel = new Panel(new BorderLayout(), Location.NORTH);
            northPanelOuter.AddComponent(northPanel);
            northPanel.AddComponent(new Panel(new BorderLayout(), Location.WEST, "pics/layout/boxS_tl.png", 16, 16));
            northPanel.AddComponent(new Panel(new BorderLayout(), Location.CENTER, "pics/layout/boxS_tc.png", 16, 16));
            northPanel.AddComponent(new Panel(new BorderLayout(), Location.EAST, "pics/layout/boxS_tr.png", 16, 16));

            #endregion

            #region Header Content Left Right

            borderLayoutPanel.AddComponent(new Panel(new BorderLayout(), Location.WEST, "pics/layout/boxS_cl.png", 16, 16));
            borderLayoutPanel.AddComponent(new Panel(new BorderLayout(), Location.EAST, "pics/layout/boxS_cr.png", 16, 16));

            #endregion

            #region Bottom Border

            var borderSouthPanel = new Panel(null, Location.SOUTH);
            borderLayoutPanel.AddComponent(borderSouthPanel);
            borderSouthPanel.AddComponent(new Panel(new BorderLayout(), Location.WEST, "pics/layout/boxS_bl.png", 16, 16));
            borderSouthPanel.AddComponent(new Panel(new BorderLayout(), Location.CENTER, "pics/layout/boxS_bc.png", 16, 16));
            borderSouthPanel.AddComponent(new Panel(new BorderLayout(), Location.EAST, "pics/layout/boxS_br.png", 16, 16));

            #endregion

            #region Header Center Label

            var borderCenterPanel      = new Panel(new GridLayout(0, 1, 1, 1), Location.CENTER);
            var borderCenterLabelPanel = new Panel(new BorderLayout(), Location.CENTER);
            borderCenterPanel.AddComponent(borderCenterLabelPanel);

            borderLayoutPanel.AddComponent(new Label(subtitle, Location.CENTER, 18, 'b')
            {
                Background = new int[] { 222, 222, 255 }
            });

            #endregion

            #endregion

            #region Content

            var contentLayoutPanel = new Panel(new BorderLayout(), Location.CENTER);
            baseFramePanel.AddComponent(contentLayoutPanel);

            var contentCenterPanel = new Panel(new BorderLayout(), Location.CENTER, "-", 15, 1);
            contentLayoutPanel.AddComponent(contentCenterPanel);

            contentCenterPanel.AddComponent(new Panel(new BorderLayout(), Location.NORTH, "-", 4, 1));

            var contentPanel = new Panel(new BorderLayout(), Location.CENTER);
            contentCenterPanel.AddComponent(contentPanel);

            contentPanel.AddComponent(kcPanel);

            contentCenterPanel.AddComponent(new Panel(new BorderLayout(), Location.EAST, "pics/layout/bg_trend.png", 1, 16));
            contentCenterPanel.AddComponent(new Panel(new BorderLayout(), Location.WEST, "pics/layout/bg_trend.png", 1, 16));

            #endregion
        }
Exemple #24
0
 public void UpdatePanel()
 {
     TextPanel.WriteText(_textBuilder.BuildText());
 }
Exemple #25
0
        /// <summary>
        /// Scripts that use UpdateManager and run on clients as well as on server shall be added here.
        /// </summary>
        private void RegisterScripts_ClientAndServer()
        {
            #region Attached

            RegisterForBlock(typeof(MyObjectBuilder_MotorStator), (block) => {
                StatorRotor.Stator stator = new StatorRotor.Stator(block);
                RegisterForUpdates(1, stator.Update10, block);
            });
            RegisterForBlock(typeof(MyObjectBuilder_MotorAdvancedStator), (block) => {
                StatorRotor.Stator stator = new StatorRotor.Stator(block);
                RegisterForUpdates(1, stator.Update10, block);
            });
            RegisterForBlock(typeof(MyObjectBuilder_MotorRotor), (block) => {
                new StatorRotor.Rotor(block);
            });
            RegisterForBlock(typeof(MyObjectBuilder_MotorAdvancedRotor), (block) => {
                new StatorRotor.Rotor(block);
            });

            RegisterForBlock(typeof(MyObjectBuilder_ExtendedPistonBase), (block) => {
                Piston.PistonBase pistonBase = new Piston.PistonBase(block);
                RegisterForUpdates(100, pistonBase.Update, block);
            });
            RegisterForBlock(typeof(MyObjectBuilder_PistonTop), (block) => {
                new Piston.PistonTop(block);
            });

            RegisterForBlock(typeof(MyObjectBuilder_ShipConnector), (block) => {
                Connector conn = new Connector(block);
                RegisterForUpdates(10, conn.Update, block);
            });

            RegisterForBlock(typeof(MyObjectBuilder_LandingGear), (block) => {
                if (!Hacker.IsHacker(block))
                    new LandingGear(block);
            });

            #endregion

            #region Antenna Communication

            Action<IMyCubeBlock> nodeConstruct = block => {
                RelayNode node = new RelayNode(block);
                RegisterForUpdates(100, node.Update100, block);
            };

            RegisterForBlock(typeof(MyObjectBuilder_Beacon), nodeConstruct);
            RegisterForBlock(typeof(MyObjectBuilder_LaserAntenna), nodeConstruct);
            RegisterForBlock(typeof(MyObjectBuilder_RadioAntenna), nodeConstruct);

            RegisterForCharacter(character => {
                if (character.IsPlayer)
                {
                    RelayNode node = new RelayNode(character);
                    RegisterForUpdates(100, node.Update100, (IMyEntity)character);
                }
                new CharacterStateTracker(character);
            });

            RegisterForBlock(typeof(MyObjectBuilder_MyProgrammableBlock), block => {
                ProgrammableBlock pb = new ProgrammableBlock(block);
                if (MyAPIGateway.Multiplayer.IsServer)
                    RegisterForUpdates(100, pb.Update100, block);
            });

            RegisterForBlock(typeof(MyObjectBuilder_TextPanel), block => {
                TextPanel tp = new TextPanel(block);
                if (MyAPIGateway.Multiplayer.IsServer)
                    RegisterForUpdates(100, tp.Update100, block);
            });

            RegisterForBlock(typeof(MyObjectBuilder_Projector), block => {
                Projector p = new Projector(block);
                if (MyAPIGateway.Session.Player != null)
                {
                    RegisterForUpdates(100, p.Update100, block);
                    RegisterForUpdates(1, p.Update1, block);
                }
            });

            if (MyAPIGateway.Session.Player != null)
                new Player();

            #endregion

            #region Autopilot

            RadarEquipment.Definition apRadar = new RadarEquipment.Definition()
            {
                Radar = true,
                LineOfSight = false,
                MaxTargets_Tracking = 3,
                MaxPowerLevel = 1000
            };

            Action<IMyCubeBlock> apConstruct = (block) => {
                if (ShipAutopilot.IsAutopilotBlock(block))
                {
                    nodeConstruct(block);
                    new AutopilotTerminal(block);
                    RadarEquipment r = new RadarEquipment(block, apRadar, block);
                    RegisterForUpdates(100, r.Update100, block);
                }
            };

            if (!MyAPIGateway.Multiplayer.IsServer)
            {
                if (ServerSettings.GetSetting<bool>(ServerSettings.SettingName.bUseRemoteControl))
                    RegisterForBlock(typeof(MyObjectBuilder_RemoteControl), apConstruct);
                RegisterForBlock(typeof(MyObjectBuilder_Cockpit), apConstruct);
            }

            #endregion

            #region Radar
            // must come after nodes are created

            if (ServerSettings.GetSetting<bool>(ServerSettings.SettingName.bAllowRadar))
            {
                RegisterForBlock(typeof(MyObjectBuilder_Beacon), (block) => {
                    if (RadarEquipment.IsRadarOrJammer(block))
                    {
                        RadarEquipment r = new RadarEquipment(block);
                        RegisterForUpdates(100, r.Update100, block);
                    }
                });
                RegisterForBlock(typeof(MyObjectBuilder_RadioAntenna), (block) => {
                    if (RadarEquipment.IsRadarOrJammer(block))
                    {
                        RadarEquipment r = new RadarEquipment(block);
                        RegisterForUpdates(100, r.Update100, block);
                    }
                });
                //RegisterForEveryBlock((IMyCubeBlock block) => {
                //	if (RadarEquipment.IsRadarOrJammer(block))
                //	{
                //		RadarEquipment r = new RadarEquipment(block);
                //		RegisterForUpdates(100, r.Update100, block);
                //	}
                //});
            }

            #endregion

            #region Terminal Control

            RegisterForBlock(new MyObjectBuilderType[] { typeof(MyObjectBuilder_RadioAntenna), typeof(MyObjectBuilder_LaserAntenna) }, block => new ManualMessage(block));

            #endregion Terminal Control

            #region Weapon Control

            if (ServerSettings.GetSetting<bool>(ServerSettings.SettingName.bAllowWeaponControl))
            {
                #region Turrets

                Action<IMyCubeBlock> constructor;
                if (ServerSettings.GetSetting<bool>(ServerSettings.SettingName.bAllowGuidedMissile))
                    constructor = block => {
                        Turret t = new Turret(block);
                        RegisterForUpdates(1, t.Update_Targeting, block);
                        if (GuidedMissileLauncher.IsGuidedMissileLauncher(block))
                        {
                            GuidedMissileLauncher gml = new GuidedMissileLauncher(t);
                            RegisterForUpdates(1, gml.Update1, block);
                        }
                    };
                else
                    constructor = block => {
                        Turret t = new Turret(block);
                        RegisterForUpdates(1, t.Update_Targeting, block);
                    };

                RegisterForBlock(typeof(MyObjectBuilder_LargeGatlingTurret), constructor);
                RegisterForBlock(typeof(MyObjectBuilder_LargeMissileTurret), constructor);
                RegisterForBlock(typeof(MyObjectBuilder_InteriorTurret), constructor);

                #endregion

                #region Fixed

                if (ServerSettings.GetSetting<bool>(ServerSettings.SettingName.bAllowGuidedMissile))
                {
                    constructor = block => {
                        FixedWeapon w = new FixedWeapon(block);
                        RegisterForUpdates(1, w.Update_Targeting, block);
                        if (GuidedMissileLauncher.IsGuidedMissileLauncher(block))
                        {
                            GuidedMissileLauncher gml = new GuidedMissileLauncher(w);
                            RegisterForUpdates(1, gml.Update1, block);
                        }
                    };
                }
                else
                    constructor = block => {
                        FixedWeapon w = new FixedWeapon(block);
                        RegisterForUpdates(1, w.Update_Targeting, block);
                    };

                RegisterForBlock(typeof(MyObjectBuilder_SmallGatlingGun), constructor);
                RegisterForBlock(typeof(MyObjectBuilder_SmallMissileLauncher), constructor);
                RegisterForBlock(typeof(MyObjectBuilder_SmallMissileLauncherReload), constructor);

                #endregion

                // apparently missiles do not have their positions synced
                RegisterForUpdates(1, GuidedMissile.Update1);
                RegisterForUpdates(10, GuidedMissile.Update10);
                RegisterForUpdates(100, GuidedMissile.Update100);
            }
            else
                myLogger.debugLog("Weapon Control is disabled", Logger.severity.INFO);

            #endregion

            new ChatHandler();
        }
Exemple #26
0
 void Awake()
 {
     textPanel = GameObject.FindGameObjectWithTag("TextPanel").GetComponent <TextPanel>();
     inventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent <Inventory>();
 }
Exemple #27
0
        private void AddPanel(PanelSettings panelSettings)
        {
            VPanel panel = null;

            switch (panelSettings.panelId)
            {
            case PanelType.SIMPLE_GAUGE:
                panel = new SimpleGauge(mainWindow, (SimpleGaugeSettings)panelSettings);
                break;

            case PanelType.SCAN_GAUGE:
                panel = new ScanGauge(mainWindow, (ScanGaugeSettings)panelSettings);
                break;

            case PanelType.ODOMETER:
                panel = new OdometerPanel(mainWindow, (OdometerSettings)panelSettings);
                break;

            case PanelType.TRANSMISSION_GAUGE:
                panel = new TransmissionIndicator(mainWindow, (TransmissionGaugeSettings)panelSettings);
                break;

            case PanelType.MULTIBAR:
                panel = new MultiBar(mainWindow, (MultiBarSettings)panelSettings);
                break;

            case PanelType.HISTOGRAM:
                break;

            case PanelType.CLOCK:
                panel = new Clock(mainWindow, (ClockSettings)panelSettings);
                break;

            case PanelType.IMAGE:
                panel = new ImagePanel(mainWindow, (PictureSettings)panelSettings);
                break;

            case PanelType.TEXT:
                panel = new TextPanel(mainWindow, (TextGaugeSettings)panelSettings);
                break;

            case PanelType.TANK_MINDER:
                panel = new TankMinderPanel(mainWindow, (TankMinderSettings)panelSettings);
                break;

            case PanelType.TIRE_GAUGE:
                panel = new TirePanel(mainWindow, (TireGaugeSettings)panelSettings);
                break;

            case PanelType.MESSAGE:
                break;

            case PanelType.DIAGNOSTIC_ALARM:
                panel = new DiagAlarmPanel(mainWindow, (DiagnosticGaugeSettings)panelSettings);
                break;

            case PanelType.RADIAL_GAUGE:
                panel = new RadialGauge(mainWindow, (RadialGaugeSettings)panelSettings);
                break;

            case PanelType.DAYNIGHT_GAUGE:
                panel = new DayNightGauge(mainWindow, (DayNightGaugeSettings)panelSettings);
                break;

            default:
                break;
            }
            if (panel != null)  //Append panel to the grid for display
            {
                PanelList.Add(panel);
                Children.Add(panel.border);
                panel.PromoteToFront();
                panel.Init();
                panel.Refresh();
            }
        }
Exemple #28
0
 /// <summary>
 /// Adds a new text status panel
 /// </summary>
 /// <param name="width">Width of panel</param>
 /// <returns>Text panel</returns>
 public IStatusText AddText(int width)
 {
     TextPanel textPanel = new TextPanel(width);
     textPanel.Name = "$Status" + (s_controlCount++).ToString();
     m_statusStrip.Items.Add(textPanel);
     return textPanel;
 }
Exemple #29
0
        public void RefreshText()
        {
            StatusLabel.Hide();

            int wordsCount = Program.TextTable.GetLength(0);

            if (wordsCount == 0)
            {
                return;
            }

            Label[] words = new Label[wordsCount];
            int[,] rawMap = new int[wordsCount + 1, 2];          //rawMap[i, 0]: the index of first word in raw i, rawMap[i, 1]: the width of this raw
            Graphics g             = TextPanel.CreateGraphics(); //for counting the text size
            int      maxWordHeight = 0;
            int      raw           = 0;                          //count of raws

            for (int i = 0; i < wordsCount; i++)
            {
                //generate new word labels
                words[i]           = new Label();
                words[i].AutoSize  = false;
                words[i].Text      = Program.TextTable[i, 0];
                words[i].Font      = WordsFont;
                words[i].TextAlign = ContentAlignment.MiddleCenter;
                words[i].ForeColor = Color.White;
                SizeF sizeF = g.MeasureString(words[i].Text, WordsFont);
                words[i].Size = new Size((int)Math.Ceiling(sizeF.Width) + 4, words[i].Height); //make ample width
                maxWordHeight = Math.Max(maxWordHeight, (int)Math.Ceiling(sizeF.Height));      //will be set after

                //group the words by property
                if (!PropertyFilter.Contains(Program.TextTable[i, 1]))
                {
                    words[i].MouseEnter += (object o, EventArgs ea) => { ((Label)o).BackColor = BackColorDefault; };
                    words[i].MouseLeave += (object o, EventArgs ea) => { ((Label)o).BackColor = BackColorEmpha; };
                    words[i].MouseHover += ShowDic;
                    words[i].MouseLeave += HideDic;
                    words[i].BackColor   = BackColorEmpha;
                }
                else
                {
                    words[i].BackColor = BackColorDefault;
                }

                //divide raws
                if (rawMap[raw, 1] + words[i].Width > TextPanel.Width)
                {
                    if (rawMap[raw, 0] > 1)
                    {
                        rawMap[raw, 1] -= WordsMargin;
                    }
                    rawMap[++raw, 0] = i;
                }
                rawMap[raw, 1] += words[i].Width + WordsMargin;
            }
            g.Dispose();

            //set all the height to the max
            for (int i = 0; i < wordsCount; i++)
            {
                words[i].Size = new Size(words[i].Width, maxWordHeight);
            }

            //allocate to different raws and set position
            rawMap[raw + 1, 0] = wordsCount; //boundary condition
            for (int r = 0; r <= raw; r++)
            {
                words[rawMap[r, 0]].Location = new Point(Math.Max((TextPanel.Width - rawMap[r, 1]) / 2, 0), (maxWordHeight + WordsRawMargin) * r);
                for (int i = rawMap[r, 0] + 1; i < rawMap[r + 1, 0]; i++)
                {
                    words[i].Location = new Point(words[i - 1].Location.X + words[i - 1].Width + WordsMargin, words[i - 1].Location.Y);
                }
            }

            //set the index for easily finding
            TextPanel.Controls.AddRange(words);
            for (int i = 0; i < wordsCount; i++)
            {
                TextPanel.Controls.SetChildIndex(words[i], i);
            }

            TextPanel.Height = maxWordHeight * (raw + 1) + WordsRawMargin * raw;
        }
Exemple #30
0
		/// <summary>
		/// <para>Scripts that use UpdateManager and run on a server shall be added here.</para>
		/// </summary>
		private void RegisterScripts_Server()
		{
			#region Autopilot

			if (ServerSettings.GetSetting<bool>(ServerSettings.SettingName.bUseRemoteControl))
				RegisterForBlock(typeof(MyObjectBuilder_RemoteControl), (IMyCubeBlock block) => {
					if (ShipController_Autopilot.IsAutopilotBlock(block))
					{
						var sca = new ShipController_Autopilot(block);
						RegisterForUpdates(ShipController_Autopilot.UpdateFrequency, sca.Update, block);
					}
				});
			RegisterForBlock(typeof(MyObjectBuilder_Cockpit), (IMyCubeBlock block) => {
				if (ShipController_Autopilot.IsAutopilotBlock(block))
				{
					var sca = new ShipController_Autopilot(block);
					RegisterForUpdates(ShipController_Autopilot.UpdateFrequency, sca.Update, block);
				}
			});

			#endregion

			#region Antenna Communication

			RegisterForBlock(typeof(MyObjectBuilder_Beacon), (IMyCubeBlock block) => {
				Beacon newBeacon = new Beacon(block);
				RegisterForUpdates(100, newBeacon.UpdateAfterSimulation100, block);
			});
			RegisterForBlock(typeof(MyObjectBuilder_TextPanel), (IMyCubeBlock block) => {
				TextPanel newTextPanel = new TextPanel(block);
				RegisterForUpdates(100, newTextPanel.UpdateAfterSimulation100, block);
			});
			RegisterForBlock(typeof(MyObjectBuilder_LaserAntenna), (IMyCubeBlock block) => {
				LaserAntenna newLA = new LaserAntenna(block);
				RegisterForUpdates(100, newLA.UpdateAfterSimulation100, block);
			});
			RegisterForBlock(typeof(MyObjectBuilder_MyProgrammableBlock), (IMyCubeBlock block) => {
				ProgrammableBlock newPB = new ProgrammableBlock(block);
				RegisterForUpdates(100, newPB.UpdateAfterSimulation100, block);
			});
			RegisterForBlock(typeof(MyObjectBuilder_RadioAntenna), (IMyCubeBlock block) => {
				RadioAntenna newRA = new RadioAntenna(block);
				RegisterForUpdates(100, newRA.UpdateAfterSimulation100, block);
			});
			RegisterForPlayer((player) => {
				Player p = new Player(player);
				RegisterForUpdates(100, p.Update100, player, Player.OnLeave);
			});
			if (ServerSettings.GetSetting<bool>(ServerSettings.SettingName.bUseRemoteControl))
				RegisterForBlock(typeof(MyObjectBuilder_RemoteControl), (IMyCubeBlock block) => {
					if (ShipController_Autopilot.IsAutopilotBlock(block))
						new ShipController(block);
					// Does not receive Updates
				});
			RegisterForBlock(typeof(MyObjectBuilder_Cockpit), (IMyCubeBlock block) => {
				if (ShipController_Autopilot.IsAutopilotBlock(block))
					new ShipController(block);
				// Does not receive Updates
			});

			#endregion

			#region Weapons

			if (ServerSettings.GetSetting<bool>(ServerSettings.SettingName.bAllowWeaponControl))
			{
				#region Turrets

				Action<IMyCubeBlock> constructor;
				if (ServerSettings.GetSetting<bool>(ServerSettings.SettingName.bAllowGuidedMissile))
					constructor = block => {
						Turret t = new Turret(block);
						RegisterForUpdates(1, t.Update_Targeting, block);
						if (GuidedMissileLauncher.IsGuidedMissileLauncher(block))
						{
							GuidedMissileLauncher gml = new GuidedMissileLauncher(t);
							RegisterForUpdates(1, gml.Update1, block);
						}
					};
				else
					constructor = block => {
						Turret t = new Turret(block);
						RegisterForUpdates(1, t.Update_Targeting, block);
					};

				RegisterForBlock(typeof(MyObjectBuilder_LargeGatlingTurret), constructor);
				RegisterForBlock(typeof(MyObjectBuilder_LargeMissileTurret), constructor);
				RegisterForBlock(typeof(MyObjectBuilder_InteriorTurret), constructor);

				#endregion

				#region Fixed


				if (ServerSettings.GetSetting<bool>(ServerSettings.SettingName.bAllowGuidedMissile))
				{
					constructor = block => {
						FixedWeapon w = new FixedWeapon(block);
						RegisterForUpdates(1, w.Update_Targeting, block);
						if (GuidedMissileLauncher.IsGuidedMissileLauncher(block))
						{
							GuidedMissileLauncher gml = new GuidedMissileLauncher(w);
							RegisterForUpdates(1, gml.Update1, block);
						}
					};

					RegisterForUpdates(1, GuidedMissile.Update1);
					RegisterForUpdates(10, GuidedMissile.Update10);
					RegisterForUpdates(100, GuidedMissile.Update100);
				}
				else
					constructor = block => {
						FixedWeapon w = new FixedWeapon(block);
						RegisterForUpdates(1, w.Update_Targeting, block);
					};

				RegisterForBlock(typeof(MyObjectBuilder_SmallGatlingGun), constructor);
				RegisterForBlock(typeof(MyObjectBuilder_SmallMissileLauncher), constructor);
				RegisterForBlock(typeof(MyObjectBuilder_SmallMissileLauncherReload), constructor);

				#endregion

				#region Disruption

				RegisterForUpdates(10, EMP.Update);
				RegisterForUpdates(10, AirVentDepressurize.Update);
				RegisterForUpdates(10, DoorLock.Update);
				RegisterForUpdates(10, GravityReverse.Update);
				RegisterForUpdates(10, DisableTurret.Update);
				RegisterForUpdates(10, TraitorTurret.Update);

				RegisterForBlock(typeof(MyObjectBuilder_LandingGear), block => {
					if (Hacker.IsHacker(block))
					{
						Hacker h = new Hacker(block);
						RegisterForUpdates(10, h.Update10, block);
					}
				});

				#endregion
			}
			else
				myLogger.debugLog("Weapon Control is disabled", "RegisterScripts_Server()", Logger.severity.INFO);

			#endregion

			#region Solar

			{
				SunProperties sun = new SunProperties();
				RegisterForUpdates(10, sun.Update10);
			}
			RegisterForBlock(typeof(MyObjectBuilder_OxygenFarm), (block) => {
				Solar s = new Solar(block);
				RegisterForUpdates(1, s.Update1, block);
			});
			RegisterForBlock(typeof(MyObjectBuilder_SolarPanel), (block) => {
				Solar s = new Solar(block);
				RegisterForUpdates(1, s.Update1, block);
			});

			#endregion

			#region Attached

			RegisterForBlock(typeof(MyObjectBuilder_MotorStator), (block) => {
				StatorRotor.Stator stator = new StatorRotor.Stator(block);
				RegisterForUpdates(1, stator.Update10, block);
			});
			RegisterForBlock(typeof(MyObjectBuilder_MotorAdvancedStator), (block) => {
				StatorRotor.Stator stator = new StatorRotor.Stator(block);
				RegisterForUpdates(1, stator.Update10, block);
			});
			RegisterForBlock(typeof(MyObjectBuilder_MotorRotor), (block) => {
				new StatorRotor.Rotor(block);
			});
			RegisterForBlock(typeof(MyObjectBuilder_MotorAdvancedRotor), (block) => {
				new StatorRotor.Rotor(block);
			});

			RegisterForBlock(typeof(MyObjectBuilder_ExtendedPistonBase), (block) => {
				Piston.PistonBase pistonBase = new Piston.PistonBase(block);
				RegisterForUpdates(100, pistonBase.Update, block);
			});
			RegisterForBlock(typeof(MyObjectBuilder_PistonTop), (block) => {
				new Piston.PistonTop(block);
			});

			RegisterForBlock(typeof(MyObjectBuilder_ShipConnector), (block) => {
				Connector conn = new Connector(block);
				RegisterForUpdates(10, conn.Update, block);
			});

			RegisterForBlock(typeof(MyObjectBuilder_LandingGear), (block) => {
				new LandingGear(block);
			});

			#endregion

			RegisterForBlock(typeof(MyObjectBuilder_OreDetector), block => {
				var od = new OreDetector(block);
				RegisterForUpdates(1000, od.Update, block);
			});

			RegisterForPlayerLeaves(UserSettings.OnPlayerLeave);
		}
Exemple #31
0
 void Awake()
 {
     textPanel = GameObject.FindGameObjectWithTag("TextPanel").GetComponent<TextPanel>();
     inventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent<Inventory>();
 }
Exemple #32
0
    public void CreateWordList(int currentLetter)
    {
        words = new List <string>();

        foreach (string w in wp.parsedWords[currentLetter])
        {
            words.Add(w);
        }
        panel_start        = true;
        current_word_index = 0;
        panel_count        = 0;
        TypeInput[] ip = FindObjectsOfType <TypeInput>();
        foreach (TypeInput t in ip)
        {
            Destroy(t.transform.parent.gameObject);
        }


        while (current_word_index < words.Count)
        {
            if (panel_start)
            {
                space_in_line = new List <int>();
                Debug.Log("create");
                panel_start   = false;
                current_panel = Instantiate(template_panel);

                current_panel.transform.SetParent(parent.transform, false);
                panel                     = current_panel.GetComponent <TextPanel>();
                panel.order_num           = panel_count;
                panel.user_panel.orderNum = panel.order_num;
            }
            else
            {
                for (int i = current_word_index; i <= words.Count; i++)
                {
                    current_word_index = i;
                    if (current_word_index == words.Count)
                    {
                        break;
                    }

                    Debug.Log(panel);
                    TMP_Text tempText     = panel.panel_text;
                    string   beforeChange = panel.panel_text.text;
                    tempText.text += words[current_word_index];

                    tempText.ForceMeshUpdate();

                    if (words[current_word_index].Contains("\n"))
                    {
                        string[] b = words[current_word_index].Split('\n');
                        panel.panel_text.text = beforeChange + b[0];
                        words.Insert(current_word_index + 1, b[1]);
                        panel_start = true;
                        panel_count++;
                        current_word_index++;
                        break;
                    }
                    else if (tempText.isTextOverflowing && !words[current_word_index].Contains("\n"))
                    {
                        Debug.Log("Overflow at " + words[current_word_index]);
                        panel.panel_text.text = beforeChange;
                        GameManager.instance.space_breaks.Add(space_in_line);
                        current_space_index = 0;
                        //current_word_index -= 1;
                        panel_start = true;
                        panel_count++;
                        break;
                    }



                    if (i != words.Count - 1)
                    {
                        panel.panel_text.text += " ";
                    }

                    panel.panel_text = tempText;
                }
                if (current_word_index == 150)
                {
                    break;
                }
            }
        }
    }
        public bool InitializeApplication(Form1 topLevelForm, CaptureDevice i_cap_device)
        {
            topLevelForm.ClientSize = new Size(SCREEN_WIDTH, SCREEN_HEIGHT);
            //キャプチャを作る(QVGAでフレームレートは30)
            i_cap_device.SetCaptureListener(this);
            i_cap_device.PrepareCapture(SCREEN_WIDTH, SCREEN_HEIGHT, 30);
            this._cap = i_cap_device;

            //ARラスタを作る(DirectShowキャプチャ仕様)。
            this._raster = new DsRgbRaster(i_cap_device.video_width, i_cap_device.video_height,NyARBufferType.BYTE1D_B8G8R8X8_32);

            //AR用カメラパラメタファイルをロードして設定
            NyARParam ap = NyARParam.createFromARParamFile(new StreamReader(AR_CAMERA_FILE));
            ap.changeScreenSize(SCREEN_WIDTH, SCREEN_HEIGHT);


            //プロセッサの準備
            this._processor = new MarkerProcessor(ap, this._raster.getBufferType());
            this._processor.setMarkerWidth(100);


            //3dデバイスを準備する
            this._device = PrepareD3dDevice(topLevelForm);
            this._device.RenderState.ZBufferEnable = true;
            this._device.RenderState.Lighting = false;
            this._device.RenderState.CullMode = Cull.CounterClockwise;

            Viewport vp = new Viewport();
            vp.X = 0;
            vp.Y = 0;
            vp.Height = ap.getScreenSize().h;
            vp.Width = ap.getScreenSize().w;
            vp.MaxZ = 1.0f;
            //ビューポート設定
            this._device.Viewport = vp;

            this._text = new TextPanel(this._device, 1);
            //カメラProjectionの設定
            Matrix tmp = new Matrix();
            NyARD3dUtil.toCameraFrustumRH(ap.getPerspectiveProjectionMatrix(), ap.getScreenSize(), 1, 10, 10000, ref tmp);

            this._device.Transform.Projection = tmp;

            // ビュー変換の設定(左手座標系ビュー行列で設定する)
            // 0,0,0から、Z+方向を向いて、上方向がY軸
            this._device.Transform.View = Matrix.LookAtLH(
                new Vector3(0.0f, 0.0f, 0.0f), new Vector3(0.0f, 0.0f, 1.0f), new Vector3(0.0f, 1.0f, 0.0f));

            //背景サーフェイスを作成
            this._surface = new NyARD3dSurface(this._device, SCREEN_WIDTH, SCREEN_HEIGHT);

            return true;
        }
 protected virtual Control GetTextControlToAdd(int xPos, int yPos, int iconWidth, int iconPadding)
 {
     if (this._txtPanel == null)
       {
     this._txtPanel = new TextPanel();
     this._txtPanel.Location = new Point(xPos + iconWidth + iconPadding, yPos);
     this._txtPanel.Width = this.Width - iconWidth - iconPadding;
     this._txtPanel.Font = this.Font;
     this._txtPanel.Text = this._parentDialog.Message;
     this._txtPanel.TabStop = false;
       }
       return (Control) this._txtPanel;
 }
Exemple #35
0
        private static void WriteComponent(IComponent com, PopupWriter buffer)
        {
            if (com.Location != Location.NONE)
            {
                buffer.Write((char)com.Location);
            }

            buffer.Write((char)com.Type);

            switch (com.Type)
            {
            case ComponentType.LABEL:
                buffer.WritePopupString(com.Text);
                buffer.WriteFontStyle(((Label)com).Style, ((Label)com).Size);
                break;

            case ComponentType.PANEL:
                Panel panel = (Panel)com;
                if (!string.IsNullOrEmpty(panel.ID))
                {
                    buffer.WritePopupString(panel.ID);
                }

                if (panel.Background != null)
                {
                    buffer.WriteBackground(panel.Background, 'b');
                }

                if (panel.BackgroundImage != null)
                {
                    buffer.Write('U');
                    buffer.WritePopupString(panel.BackgroundImage);
                    buffer.Write('U');
                    buffer.WriteShort(panel.Width);
                    buffer.WriteShort(panel.Height);
                }
                if (panel.Layout != null)
                {
                    buffer.WriteLayout((char)panel.Layout.Type);
                    switch (panel.Layout.Type)
                    {
                    case LayoutType.GRID_LAYOUT:
                        GridLayout grid = (GridLayout)panel.Layout;
                        buffer.WriteSize(grid.Rows);
                        buffer.WriteSize(grid.Cols);
                        buffer.WriteSize(grid.HGap);
                        buffer.WriteSize(grid.VGap);
                        break;
                    }
                }
                var coms = panel.Components;
                foreach (var c in coms)
                {
                    WriteComponent(c, buffer);
                }
                break;

            case ComponentType.TEXT_PANEL:
                TextPanel tp = (TextPanel)com;
                buffer.WritePopupString(string.Format("°R>{{linkhovercolor}}<r°{0}°>{{linkhovercolorreset}}<°", com.Text));
                buffer.WriteFrameSize(tp.Width, tp.Height);
                buffer.WriteBackgroundImage(tp.BackgroundImage, tp.BackgroundPosition);
                break;

            case ComponentType.BUTTON:
                buffer.WritePopupString(com.Text);
                Button button = (Button)com;
                if (button.FontSize != 14 || button.FontWeight != 'p')
                {
                    buffer.WriteFontStyle(button.FontWeight, button.FontSize);
                }

                if (button.Styled)
                {
                    buffer.Write('c');
                    if (button.Colored)
                    {
                        buffer.Write('e');
                    }
                }

                if (button.Close)
                {
                    buffer.Write('d');
                }
                if (button.Action)
                {
                    buffer.Write('s');
                }

                // KP ?
                buffer.Write('b');
                buffer.Write('g');
                buffer.Write('O');

                if (button.Command != null)
                {
                    buffer.Write('u');
                    buffer.WritePopupString(button.Command);
                }
                break;

            case ComponentType.TEXT_FIELD:
                buffer.WritePopupString(com.Text);
                buffer.WriteSize(((TextField)com).Width);
                break;

            case ComponentType.TEXT_AREA:
                buffer.WritePopupString(com.Text);
                TextArea textarea = (TextArea)com;
                buffer.WriteSize(textarea.Rows);
                buffer.WriteSize(textarea.Cols);

                switch (textarea.Scrollbars)
                {
                case 0:
                    buffer.Write('b');
                    break;

                case 1:
                    buffer.Write('s');
                    break;

                case 2:
                    buffer.Write('w');
                    break;
                }
                if (textarea.Editable)
                {
                    buffer.Write('e');
                }
                break;

            case ComponentType.CHECKBOX:
                if (com.Text != null)
                {
                    buffer.Write('l');
                    buffer.WritePopupString(com.Text);
                }

                buffer.WriteFontStyle('p', 16);
                Checkbox checkbox = (Checkbox)com;

                if (checkbox.Disabled)
                {
                    buffer.Write('d');
                }

                if (checkbox.Selected)
                {
                    buffer.Write('s');
                    buffer.Write('t');
                }

                if (checkbox.Group != 0)
                {
                    buffer.Write('r');
                    buffer.WriteSize(checkbox.Group);
                }
                break;

            case ComponentType.CHOICE:
                Choice choice = (Choice)com;
                if (choice.Selected == null)
                {
                    buffer.Write('c');
                    buffer.Write(choice.SelectedIndex);
                }
                else
                {
                    buffer.Write('C');
                    buffer.WritePopupString(choice.Selected);
                }

                if (choice.Fontsize > 0)
                {
                    buffer.WriteFontStyle('p', choice.Fontsize);
                }

                if (choice.Disabled)
                {
                    buffer.Write('d');
                }

                buffer.WriteForeground(com.Foreground);
                buffer.WriteBackground(com.Background);

                buffer.WriteEnd();
                foreach (var item in choice.Items)
                {
                    buffer.WritePopupString(item);
                }
                break;
            }
            if (com.Type != ComponentType.PANEL && com.Type != ComponentType.CHOICE)
            {
                if (com.Background != new int[] { 255, 255, 255 })
                {
                    buffer.WriteBackground(com.Background);
                }
                if (com.Foreground != new int[] { 0, 0, 0 })
                {
                    buffer.WriteForeground(com.Foreground);
                }
            }

            buffer.WriteEnd();
        }
Exemple #36
0
    //Rearranges the columns with sorting rules applied.
    private void SortColumns(bool _byCountry)
    {
        m_xVelocity = m_xAcceleration = 0.0f;   //Stop things moving.
        if (m_TextPanels.Count > 0)             //Get rid of any existing panels
        {
            foreach (TextPanel tp in m_TextPanels)
            {
                DestroyObject(tp.gameObject);
            }
            m_TextPanels.Clear();
        }

        if (_byCountry)
        {
            SortCountries();
        }
        else
        {
            SortDates();
        }

        float x        = xSpacing;
        float y        = ySpacing * 2 - 0.1f;
        float yPadding = 0.3f;
        int   row      = 0;
        int   column   = 0;

        List <ThumbTile>    temp      = new List <ThumbTile>();
        List <ColumnAnchor> tempAnchs = new List <ColumnAnchor>();

        if (_byCountry)
        {
            foreach (string str in m_Countries)
            {
                TextPanel tempTx = Instantiate(m_TextPanelPrefab) as TextPanel;                   //First a title panel is made to denote the country
                Vector3   pos    = new Vector3(x * column, y, -0.1f);

                tempTx.transform.parent = m_ThumbAnchor.transform;
                tempTx.SetPos(pos);

                tempTx.SetText(str == "" ? "Unknown" : str);
                m_TextPanels.Add(tempTx);

                ColumnAnchor anchor = Instantiate(m_ColumnAnchorPrefab) as ColumnAnchor;
                anchor.transform.parent = m_ThumbAnchor.transform;
                anchor.LocalPos         = new Vector3(x * column, -(row * ySpacing) + ySpacing, 0.0f);
                if (_byCountry)
                {
                    for (int i = 0; i < m_Thumbs.Count; ++i)
                    {
                        if (m_Thumbs[i].Image.Country == str)
                        {
                            ThumbTile tempTile = Instantiate(m_TilePrefab) as ThumbTile;
                            tempTile.transform.parent = anchor.transform;
                            tempTile.SetThumb(m_Thumbs[i].Image);
                            Vector3 tPos = new Vector3(0.0f, -(row * ySpacing) - yPadding, 0.0f);
                            tempTile.Pointer = m_Pointer;
                            tempTile.SetPos(tPos);
                            tempTile.CarouselPos = i;
                            temp.Add(tempTile);

                            row++;
                        }
                    }
                }
                anchor.Tiles       = row;
                anchor.BottomPoint = -(row * ySpacing) + ySpacing;
                tempAnchs.Add(anchor);
                column++;
                row = 0;
            }
        }
        else
        {
            foreach (DateTime str in m_Dates)
            {
                TextPanel tempTx = Instantiate(m_TextPanelPrefab) as TextPanel;                   //First a title panel is made to denote the country
                Vector3   pos    = new Vector3(x * column, y, -0.1f);

                tempTx.transform.parent = m_ThumbAnchor.transform;
                tempTx.SetPos(pos);

                tempTx.SetText(str == new DateTime(1970, 1, 1) ? "Unknown" : DateFormat.WrittenDate(str));
                m_TextPanels.Add(tempTx);

                ColumnAnchor anchor = Instantiate(m_ColumnAnchorPrefab) as ColumnAnchor;
                anchor.transform.parent = m_ThumbAnchor.transform;
                anchor.LocalPos         = new Vector3(x * column, -(row * ySpacing) + ySpacing, 0.0f);

                for (int i = 0; i < m_Thumbs.Count; ++i)
                {
                    if (m_Thumbs[i].Image.Date == str)
                    {
                        ThumbTile tempTile = Instantiate(m_TilePrefab) as ThumbTile;
                        tempTile.transform.parent = anchor.transform;
                        tempTile.SetThumb(m_Thumbs[i].Image);
                        Vector3 tPos = new Vector3(0.0f, -(row * ySpacing) - yPadding, 0.0f);
                        tempTile.Pointer = m_Pointer;
                        tempTile.SetPos(tPos);
                        tempTile.CarouselPos = i;
                        temp.Add(tempTile);

                        row++;
                    }
                }
                anchor.Tiles       = row;
                anchor.BottomPoint = -(row * ySpacing) + ySpacing;
                tempAnchs.Add(anchor);
                column++;
                row = 0;
            }
        }
        m_NumColumns = column + 1;
        foreach (ThumbTile thumb in m_Thumbs)
        {
            DestroyObject(thumb.gameObject);
        }
        m_Thumbs.Clear();
        m_Thumbs = temp;

        if (m_ColumnAnchors.Count > 0)
        {
            foreach (ColumnAnchor an in m_ColumnAnchors)
            {
                DestroyObject(an.gameObject);
            }
        }
        m_ColumnAnchors.Clear();
        m_ColumnAnchors = tempAnchs;
    }