Exemplo n.º 1
0
 /// <summary>
 /// Modifica il blocco nemico indicato. (Mancano i controlli di integrità).
 /// </summary>
 /// <param name="p">Blocco nemico indicato</param>
 /// <param name="Orient">Stringa che riguarda l'orientamento sulla superficie (dov'è il "basso" per tale blocco)</param>
 /// <param name="enPer">Indica quanti millisecondi ci mette a percorrere il suo ciclo</param>
 /// <param name="enRan">Indica quanti blocchi è in grado di coprire.</param>
 /// <returns></returns>
 private bool TreatEnemy(KulaLevel.Enemy e, string Orient, uint enPer, uint enRan)
 {
     e.ChangeOrientation(TileConverter.StringToOrientation(Orient));
     e.Period = enPer;
     e.Range  = (byte)(enRan % 256);
     return(true);
 }
Exemplo n.º 2
0
        public bool ChangeInsertingTile(string TileType, string SpecType, string Prop1, string Prop2, string Prop3, string Prop4, uint Prop5, uint Prop6, uint SProp1, uint SProp2)
        {
            if (isLoaded && Mode == EditorMode.InsertMode)
            {
                #region Caso in cui la tile da inserire sia null o sia di tipo diverso da quello ora selezionato
                if (TileToBeAdded == null || TileToBeAdded.TileType.ToString() != TileType)
                {
                    isReadyToInsert = false;
                    switch (TileType)
                    {
                    case ("Block"):
                    {
                        TileToBeAdded = new KulaLevel.Block();
                        break;
                    }

                    case ("Placeable"):
                    {
                        TileToBeAdded = new KulaLevel.Placeable();
                        break;
                    }

                    case ("Enemy"):
                    {
                        TileToBeAdded = new KulaLevel.Enemy();
                        break;
                    }

                    default:
                    {
                        TileToBeAdded = null;
                        break;
                    }
                    }
                    return(true);
                }
                #endregion
                #region Caso in cui la tile da inserire sia già del tipo selezionato.
                else
                {
                    KulaLevel.MapTile t = TileToBeAdded;
                    TreatSwitch(t, SpecType, Prop1, Prop2, Prop3, Prop4, Prop5, Prop6, SProp1, SProp2);
                    isReadyToInsert = true;
                }
                #endregion
                OnChangedTileProperties(new ChangedTilePropertiesEventArgs(this));
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 3
0
        private void ActivateGoodControls(KulaLevel.MapTile mt, bool isSelectionMode)
        {
            TopSplitter.Panel1.Enabled    = true;
            lblTileTyping.Enabled         = true;
            BottomSplitter.Panel2.Enabled = true;
            btnApplyChanges.Enabled       = true;
            if (!isSelectionMode)
            {
                cboTileType.Enabled = true;
                lblTileType.Enabled = true;
            }
            if (mt != null)
            {
                string s;
                #region Imposto i controlli del pannello superiore.
                lblSpecificType.Enabled = true;
                if (!isSelectionMode)
                {
                    cboTileType.Enabled = true;
                    lblTileType.Enabled = true;
                }

                if (cboTileType.Items.Contains(s = mt.TileType.ToString()))
                {
                    cboTileType.SelectedIndex = cboTileType.Items.IndexOf(s);
                }
                else
                {
                    cboTileType.SelectedIndex = 0;
                }

                cboSpecificType.Enabled = true;
                cboSpecificType.Items.Clear();
                cboSpecificType.Items.AddRange(TileConverter.GetSpecificTypesOf(mt.TileType));
                if (cboSpecificType.Items.Contains(s = TileConverter.FromByteSpecificType(mt.TileType, mt.Type)))
                {
                    cboSpecificType.SelectedIndex = cboSpecificType.Items.IndexOf(s);
                }
                else
                {
                    cboSpecificType.SelectedIndex = 0;
                }
                #endregion

                #region Imposto i controlli del pannello in mezzo e inferiore.
                BottomSplitter.Panel1.Enabled = true;
                lblTileProperties.Enabled     = true;
                BottomSplitter.Panel2.Enabled = true;
                btnApplyChanges.Enabled       = true;
                #region Caso di blocco
                if (mt.TileType == KulaLevel.TileType.Block)
                {
                    KulaLevel.Block b = (KulaLevel.Block)mt;
                    #region Abilito i controlli del pannello intermedio
                    EnablingTheseControls(true, BottomSplitter.Panel1.Controls);
                    #endregion
                    #region Sistemo i radiobuttons.
                    isManipulatingOptions = true;
                    foreach (RadioButton o in options)
                    {
                        o.Checked = false;
                    }
                    if (editLvlEditor.ChosenFaceDirection == KulaLevel.Orientation.Up)
                    {
                        options[0].Checked = true;
                    }
                    else if (editLvlEditor.ChosenFaceDirection == KulaLevel.Orientation.Down)
                    {
                        options[1].Checked = true;
                    }
                    else if (editLvlEditor.ChosenFaceDirection == KulaLevel.Orientation.Left)
                    {
                        options[2].Checked = true;
                    }
                    else if (editLvlEditor.ChosenFaceDirection == KulaLevel.Orientation.Right)
                    {
                        options[3].Checked = true;
                    }
                    isManipulatingOptions = false;
                    #endregion
                    #region Sistemo i combobox e la label principale.
                    lblSpecificProperties.Text = "Block Properties";
                    lblProperty1.Text          = "Upper Surface:";
                    lblProperty2.Text          = "Lower Surface:";
                    lblProperty3.Text          = "Left Surface:";
                    lblProperty4.Text          = "Right Surface:";
                    for (int i = 0; i < 4; i++)
                    {
                        ComboBox c = (ComboBox)midControls[i];
                        c.Items.Clear();
                        foreach (KulaLevel.SurfaceType t in TileConverter.surfaces)
                        {
                            c.Items.Add(t.ToString());
                        }
                        if (c.Items.Contains(s = b.GetSurfaceAtFace(a[i]).Type.ToString()))
                        {
                            c.SelectedIndex = c.Items.IndexOf(s);
                        }
                        else
                        {
                            c.SelectedIndex = 0;
                        }
                    }
                    #endregion
                    #region Sistemo i numericupdown
                    changeNumericValues(numProperty5, 2000, 6000, 100, (int)b.DisappearPeriod);
                    changeNumericValues(numProperty6, 0, 2000, 100, (int)b.DisappearBegin);
                    #endregion
                    #region Abilito i controlli del pannello inferiore
                    BottomSplitter.Panel2.Enabled = true;
                    btnSpecificProp7.Enabled      = true;
                    btnSpecificProp7.Text         = "Bind Teleport";
                    txtSpecificProp7.Enabled      = true;
                    lblSpecificProp1.Enabled      = true;
                    lblSpecificProp1.Text         = "Spikes Period:";
                    lblSpecificProp2.Enabled      = true;
                    lblSpecificProp2.Text         = "Spikes Begin:";
                    numSpecificProp1.Enabled      = true;
                    numSpecificProp2.Enabled      = true;
                    #endregion
                    #region Sistemo le proprietà per la superficie scelta
                    SetupSurfaceInterface(b);
                    #endregion
                }
                #endregion
                #region Caso di oggetto posizionabile
                else if (mt.TileType == KulaLevel.TileType.Placeable)
                {
                    KulaLevel.Placeable p = (KulaLevel.Placeable)mt;
                    #region Abilito i controlli del pannello intermedio
                    lblProperty1.Enabled = true;
                    cboProperty1.Enabled = true;
                    #endregion
                    #region Sistemo i testi delle label e della combobox
                    lblTileProperties.Text = "Placeable Properties";
                    lblProperty1.Text      = "Orientation";
                    #endregion
                    #region Sistemo la/le combobox
                    if (TileConverter.FromByteSpecificType(p.TileType, p.Type) == "Gravity Changer")
                    {
                        cboProperty2.Items.Clear();
                        foreach (KulaLevel.Orientation o in a)
                        {
                            cboProperty2.Items.Add(o.ToString());
                        }
                        cboProperty2.SelectedIndex = cboProperty2.Items.IndexOf(p.GChangerDirection.ToString());
                        cboProperty2.Enabled       = true;
                        lblProperty2.Enabled       = true;
                        lblProperty2.Text          = "G.Changer Direction: ";
                    }
                    cboProperty1.Enabled = true;
                    cboProperty1.Items.Clear();
                    foreach (KulaLevel.Orientation o in a)
                    {
                        cboProperty1.Items.Add(o.ToString());
                    }
                    cboProperty1.SelectedIndex = cboProperty1.Items.IndexOf(p.Orientation.ToString());
                    #endregion
                }
                #endregion
                #region Caso di nemico
                else if (mt.TileType == KulaLevel.TileType.Enemy)
                {
                    KulaLevel.Enemy e = (KulaLevel.Enemy)mt;
                    #region Abilito i controlli del pannello intermedio
                    lblProperty1.Enabled = true;
                    cboProperty1.Enabled = true;
                    #endregion
                    #region Sistemo i testi delle label e della combobox
                    lblTileProperties.Text = "Enemy Properties";
                    lblProperty1.Text      = "Orientation";
                    #endregion
                    #region Mi occupo della combobox intermedia.
                    cboProperty1.Enabled = true;
                    cboProperty1.Items.Clear();
                    foreach (KulaLevel.Orientation o in a)
                    {
                        cboProperty1.Items.Add(o.ToString());
                    }
                    cboProperty1.SelectedIndex = cboProperty1.Items.IndexOf(e.Orientation.ToString());
                    #endregion
                    #region Mi occupo dell'interfaccia inferiore, se il nemico è un sinusoidale
                    if (e.Type == 0)
                    {
                        numSpecificProp2.Enabled = true;
                        numSpecificProp1.Enabled = true;
                        lblSpecificProp1.Enabled = true;
                        lblSpecificProp2.Enabled = true;
                        lblSpecificProp1.Text    = "Enemy period:";
                        lblSpecificProp2.Text    = "Enemy range:";
                        changeNumericValues(numSpecificProp1, 2000, 6000, 100, (int)e.Period);
                        changeNumericValues(numSpecificProp2, 0, 100, 1, (int)e.Range);
                    }
                    #endregion
                }
                #endregion
                #endregion
            }
        }