예제 #1
0
    public override void UpdateMonster(string obj_name, params object[] parameter)
    {
        Debug.Log(obj_name + "// Updated");
        //parameter [0] : stair
        //parameter [1] : floor
        //parameter [2] : lastCount


        int stair     = (int)parameter[0];
        int floor     = (int)parameter[1];
        int lastCount = (int)parameter[2];

        int list_index = -1;
        List <trap_data_struct> load_list = null;


        if (trap_data_dic.TryGetValue(obj_name, out load_list))
        {
            if ((list_index = GetObjectListIndex(load_list, stair, floor)) >= 0)
            {
                trap_data_struct loadStruct = load_list[list_index];

                loadStruct.StairIndex = stair;
                loadStruct.Tileindex  = floor;
                loadStruct.TrapCount  = lastCount;

                load_list.RemoveAt(list_index);
                load_list.Insert(list_index, loadStruct);
            }
        }
    }
예제 #2
0
    public override void InstallMonster(int stair, int floor, int level, string _name)
    {
        trap_data_struct        trap_struct = new trap_data_struct(stair, floor, level);
        List <trap_data_struct> trap_list   = null;

        if (trap_data_dic.ContainsKey(_name) && trap_data_dic.TryGetValue(_name, out trap_list))
        {
            trap_data_dic.Remove(_name);
        }
        else
        {
            trap_list = new List <trap_data_struct> ();
        }

        trap_list.Sort(delegate(trap_data_struct x, trap_data_struct y) {
            if (x.Tileindex < y.Tileindex)
            {
                return(-1);
            }
            else if (x.Tileindex > y.Tileindex)
            {
                return(1);
            }
            else if (x.StairIndex < y.StairIndex)
            {
                return(-1);
            }
            else if (x.StairIndex > y.StairIndex)
            {
                return(1);
            }
            else
            {
                return(0);
            }
        });

        if (trap_list != null)
        {
            trap_list.Add(trap_struct);
            trap_data_dic.Add(_name, trap_list);
        }
        Debug.Log("Saved " + _name + " / " + trap_struct.ToString() + "/ List Count" + trap_list.Count
                  + "/ Dictionary Count" + trap_data_dic.Count);
    }