Esempio n. 1
0
    /// <summary>
    /// Will update Propersties on AllRegFile so when is saved is there to be loaded
    ///
    /// Prop that Update so far:
    /// BookedHome1
    /// Instruction
    /// Families
    /// Invetory
    /// PeopleDic
    /// PositionFilled
    /// Anchors
    /// DollarsPay
    /// Dock1
    /// PlantSave1
    /// Dispatch
    /// BuildersManager1
    /// CurrentProd
    /// </summary>
    public void ResaveOnRegistro(string myIdP)
    {
        //for when Building is loading and writing PeopleDict
        if (!AllBuilding.ContainsKey(myIdP))
        {
            return;
        }

        var build = AllBuilding[myIdP];
        int index = AllRegFile.FindIndex(a => a.MyId == myIdP);

        //bz when destroying Way this method is called
        if (index == -1)
        {
            return;
        }

        AllRegFile[index].BookedHome1 = build.BookedHome1;
        AllRegFile[index].Instruction = build.Instruction;
        AllRegFile[index].Familes     = build.Families;
        AllRegFile[index].Inventory   = build.Inventory;
        AllRegFile[index].PeopleDict  = build.PeopleDict;
        AllRegFile[index].Anchors     = build.Anchors.ToArray();

        //UVisHelp.CreateHelpers(build.Anchors, Root.yellowCube);

        AllRegFile[index].DollarsPay       = build.DollarsPay;
        AllRegFile[index].Dock1            = build.Dock1;
        AllRegFile[index].Dispatch1        = build.Dispatch1;
        AllRegFile[index].BuildersManager1 = build.BuildersManager1;
        AllRegFile[index].PlantSave1       = build.PlantSave1;
        AllRegFile[index].CurrentProd      = build.CurrentProd;
        AllRegFile[index].Name             = build.NameBuilding();
    }
Esempio n. 2
0
File: Registro.cs Progetto: Cdrix/SM
    /// <summary>
    /// So its removed at the end so no new buildings are created on top of building that will be removed soon
    /// </summary>
    /// <param name="myId"></param>
    public void RemoveFromAllRegFile(string myId)
    {
        int index = AllRegFile.FindIndex(a => a.MyId == myId);

        //bz when destroying Way this method is called at least two times.
        //the 2nd time doesnt find the index bz was removed already
        if (index == -1)
        {
            return;
        }

        AllRegFile.RemoveAt(index);
    }
Esempio n. 3
0
File: Registro.cs Progetto: Cdrix/SM
    /// <summary>
    /// This is intended to save the new material assigned to the building on disk
    /// </summary>
    public void UpdateItemMaterial(Ca cat, string myId, string newMatKey)
    {
        int index = AllRegFile.FindIndex(a => a.MyId == myId);

        AllRegFile[index].MaterialKey = newMatKey;

        if (cat == Ca.Way)
        {
            Ways[myId].MaterialKey = newMatKey;
        }
        else if (cat == Ca.Structure || cat == Ca.Shore)
        {
            Structures[myId].MaterialKey = newMatKey;
        }
        else if (cat == Ca.DraggableSquare)
        {
            DragSquares[myId].MaterialKey = newMatKey;
        }
    }