Esempio n. 1
0
        public static void save_Game_Action(Save_tag path, Game_Action c)
        {
            Save_tag a = path.copy();

            a.add_tag("ID");
            save_long(a, c.get_ID());
            List <float> parameters = new List <float>();
            Save_tag     e          = path.copy();

            e.add_tag("text");
            save_string(e, c.get_info());
            Save_tag b = path.copy();

            b.add_tag("params");
            if (c.get_ID() == 1)
            {
                Give_player_something gpi = (Give_player_something)c;
                parameters.Add(gpi.ID_given);
                parameters.Add(gpi.amount_given);
            }
            else if (c.get_ID() == 2)
            {
                Shift_quest_from_archive sqfa = (Shift_quest_from_archive)c;
                parameters.Add(sqfa.code);
            }
            else if (c.get_ID() == 3)
            {
                Change_relations cr = (Change_relations)c;
                parameters.Add(cr.fraction);
                parameters.Add(cr.delta);
            }
            else if (c.get_ID() == 4)
            {
                Start_dialogue sd = (Start_dialogue)c;
                Save_tag       q  = path.copy();
                q.add_tag("dialogue");
                save_Dialogue(q, sd.dia);
            }
            else if (c.get_ID() == 5)
            {
                Deal_damage_to_player ddtp = (Deal_damage_to_player)c;
                parameters.Add(ddtp.amount);
            }
            save_list_of_floats(b, parameters);
        }
Esempio n. 2
0
        public static Game_Action load_Game_Action(Save_tag path)
        {
            Game_Action c = null;
            Save_tag    a = path.copy();

            a.add_tag("ID");
            long         ID = load_long(a);
            List <float> ps = new List <float>();
            Save_tag     e  = path.copy();

            e.add_tag("text");
            string   s = load_string(e);
            Save_tag b = path.copy();

            b.add_tag("params");
            ps = load_list_of_floats(b);
            if (ID == 1)
            {
                c = new Give_player_something((long)ps[0], ps[1]);
            }
            else if (ID == 2)
            {
                c = new Shift_quest_from_archive((int)(ps[0]));
            }
            else if (ID == 3)
            {
                c = new Change_relations((int)ps[0], ps[1]);
            }
            else if (ID == 4)
            {
                Save_tag q = path.copy();
                q.add_tag("dialogue");
                Dialogue dd = load_Dialogue(q);
                c = new Start_dialogue(dd);
            }
            else if (c.get_ID() == 5)
            {
                c = new Deal_damage_to_player(ps[0]);
            }
            return(c);
        }