Esempio n. 1
0
 public void Reset()
 {
     ItemList.Clear();
     EnemyList.Clear();
     BlockList.Clear();
     BackgroundList.Clear();
 }
Esempio n. 2
0
 void Start()
 {
     this.gameObject.SetActive(false);
     this.controller = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController>();
     if (this.controller.isGM)
     {
         RectTransform rectTransform = this.gameObject.GetComponent <RectTransform>();
         this.gameObject.transform.Find("Background").gameObject.SetActive(true);
         rectTransform.sizeDelta = new Vector2(200, 90);
         rectTransform.position  = new Vector2(rectTransform.position.x, rectTransform.position.y - 15);
         this.controller.SendGetRequest("api/backgrounds", (request) =>
         {
             this.backgroundList = JsonUtility.FromJson <BackgroundList>(string.Format("{{\"list\": {0}}}", request.downloadHandler.text));
             foreach (BackgroundStruct background in this.backgroundList.list)
             {
                 this.backgroundSelect.options.Add(new Dropdown.OptionData()
                 {
                     text = background.title
                 });
             }
         }, (request) =>
         {
         });
     }
 }
 private void GetBackgroundList()
 {
     if (Directory.Exists(Static.Paths.DirBackgrounds))
     {
         DirectoryInfo DI = new DirectoryInfo(Static.Paths.DirBackgrounds);
         foreach (var file in DI.GetFiles(@"*.png"))
             BackgroundList.Add(file.Name);
     }
 }
Esempio n. 4
0
        public XmlBackground(BackgroundList b, int addlevel)
        {
            m_Background = b;
            m_Level = addlevel;

            if (m_Level < 0)
                Name = (m_Background.ToString() + " " + m_Level.ToString());
            else
                Name = (m_Background.ToString() + " +" + m_Level.ToString());
        }
Esempio n. 5
0
        public XmlBackground(BackgroundList b, int addlevel, int duration)
        {
            m_Background = b;
            m_Level = addlevel;
            Expiration = TimeSpan.FromMinutes(duration);

            if (m_Level < 0)
                Name = (m_Background.ToString() + " " + m_Level.ToString());
            else
                Name = (m_Background.ToString() + " +" + m_Level.ToString());
        }
Esempio n. 6
0
 public static void CleanUp(PlayerMobile m, BackgroundList ListName)
 {
     List<XmlBackground> removeAtt = new List<XmlBackground>();
         foreach (XmlBackground att in XmlAttach.FindAttachments(m, typeof(XmlBackground)))
         {
             if (att.Background == ListName)
                 removeAtt.Add(att);
         }
         for (int i = removeAtt.Count - 1; i > -1; i--)
         {
             removeAtt[i].Delete();
         }
 }
Esempio n. 7
0
        public static int GetLevel(Mobile m, BackgroundList bg)
        {
            int bLevel = 0;

            if (m == null)
                return 0;

            ArrayList backgroundAttachments = XmlAttach.FindAttachments(m, typeof(XmlBackground));

            if (backgroundAttachments != null)
            {
                foreach (XmlBackground att in backgroundAttachments)
                {
                    if (att.Background == bg)
                        bLevel += att.Level;
                }
            }

            if (m.Items != null)
            {
                foreach (Item item in m.Items)
                {
                    ArrayList itemAtts = XmlAttach.FindAttachments(item, typeof(XmlBackground));
                    if (itemAtts != null)
                    {
                        foreach (XmlBackground iAtt in itemAtts)
                        {
                            if (iAtt.Background == bg)
                                bLevel += iAtt.Level;
                        }
                    }
                }
            }

            return bLevel;
        }
Esempio n. 8
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();
            m_Background = (BackgroundList)reader.ReadInt();
            m_Level = reader.ReadInt();
        }
 //#region INotifyPropertyChanged implementation
 //public event PropertyChangedEventHandler PropertyChanged;
 //protected void Notify(string propertyName)
 //{
 //    if (this.PropertyChanged != null)
 //    {
 //        PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
 //    }
 //}
 //#endregion INotifyPropertyChanged implementation
 //double _glyphScale = 1;
 //BitmapSource _Image;
 //Color _ColorText;
 //Color _ColorName;
 //Point _TextStart;
 //Point _NameStart;
 //int _LineSpacing;
 //public Point TextStart
 //{
 //    get { return _TextStart; }
 //    private set
 //    {
 //        if (value != _TextStart)
 //        {
 //            _TextStart = value;
 //            Notify("TextStart");
 //        }
 //    }
 //}
 //public Point NameStart
 //{
 //    get { return _NameStart; }
 //    private set
 //    {
 //        if (value != _NameStart)
 //        {
 //            _NameStart = value;
 //            Notify("NameStart");
 //        }
 //    }
 //}
 //public double GlyphScale
 //{
 //    get { return _glyphScale; }
 //    private set
 //    {
 //        if (value != _glyphScale)
 //        {
 //            _glyphScale = value;
 //            Notify("GlyphScale");
 //        }
 //    }
 //}
 //public BitmapSource Image
 //{
 //    get { return _Image; }
 //    private set
 //    {
 //        if (value != _Image)
 //        {
 //            _Image = value;
 //            Drawing.ImageSource = _Image;
 //            Drawing.Rect = new Rect(0, 0, _Image.Width, _Image.Height);
 //            Rect.Rect = Drawing.Rect;
 //            Notify("Image");
 //        }
 //    }
 //}
 //public Color ColorText
 //{
 //    get { return _ColorText; }
 //    set
 //    {
 //        if (_ColorText != value)
 //        {
 //            _ColorText = value;
 //            Notify("ColorText");
 //        }
 //    }
 //}
 //public Color ColorName
 //{
 //    get { return _ColorName; }
 //    set
 //    {
 //        if (_ColorName != value)
 //        {
 //            _ColorName = value;
 //            Notify("ColorName");
 //        }
 //    }
 //}
 //public int LineSpacing
 //{
 //    get { return _LineSpacing; }
 //    set
 //    {
 //        if (_LineSpacing != value)
 //        {
 //            _LineSpacing = value;
 //            Notify("LineSpacing");
 //        }
 //    }
 //}
 //public ImageDrawing Drawing { get; private set; } = new ImageDrawing();
 //public RectangleGeometry Rect { get; private set; } = new RectangleGeometry();
 public Backgrounds()
 {
     BackgroundList.Add("Default");
     CurrentBackground.SetDefault();
     GetBackgroundList();
 }
Esempio n. 10
0
 public BackgroundTarget( BackgroundList background, int level, bool setting )
     : base(30, false, TargetFlags.None)
 {
     m_Background = background;
     m_Level = level;
     m_Setting = setting;
 }
Esempio n. 11
0
        public static BaseBackground ConvertBackgroundListToBackgroundObject( BackgroundList list )
        {
            if( Catalogue.ContainsKey(list) )
                return Catalogue[list];

            return null;
        }
Esempio n. 12
0
 public int GetBackgroundLevel(BackgroundList b)
 {
     return Backgrounds.BackgroundDictionary[b].Level + XmlBackground.GetLevel(this, b);
 }
Esempio n. 13
0
 // Set background according to the background in use.
 public void SetBackgroundBasedOnGameData()
 {
     UpdateBackgroundInUse(BackgroundList.GetBackgroundByName(backgroundInUseName));
 }
Esempio n. 14
0
        public override void ImGuiLayout()
        {
            //MainTab
            if (ImGui.BeginMainMenuBar())
            {
                if (ImGui.BeginMenu("File"))
                {
                    if (ImGui.MenuItem("Save"))
                    {
                        _game.Exit();
                    }
                    ImGui.MenuItem("Load");
                    ImGui.EndMenu();
                }

                if (ImGui.BeginMenu("View"))
                {
                    ImGui.Checkbox("Editor Tile Grid", ref viewTileGrid);
                    ImGui.EndMenu();
                }

                if (RunningGame)
                {
                    if (ImGui.MenuItem("Stop Run"))
                    {
                        RunningGame = false;
                        gameRunner  = null;
                    }
                }
                else if (ImGui.MenuItem("Run"))
                {
                    gameRunner = new GameRunner(_game._graphics, _game.spriteBatch, _game.Content);
                    LevelScene ls = new LevelScene(gameRunner, TileLayers);
                    ls.Backgrounds          = BackgroundList.ToArray();
                    gameRunner.CurrentScene = ls;

                    RunningGame = true;
                }

                ImGui.EndMainMenuBar();
            }

            if (!RunningGame)
            {
                TilePallateWindow();
                //Tile Layers window
                if (ImGui.BeginTabBar("Layers"))
                {
                    TileLayerWindow();
                    BackgroundTab();
                    ImGui.EndTabBar();
                }


                GameWindow();
            }
            else
            {
                ImGui.Begin("GameWindow", ref RunningGame, ImGuiWindowFlags.AlwaysAutoResize);

                ImGui.Image(levelTexture, new Num.Vector2(Screen.GameWidth, Screen.GameHeight) * 3);

                ImGui.End();
            }
        }
Esempio n. 15
0
 public void OnBackgroundGarageItemClicked(int backgroundIndex)
 {
     SwitchToTargetBackground(BackgroundList.GetBackgroundByIndex(backgroundIndex));
 }