Beispiel #1
0
    /// <summary>
    /// Store Google details into database through business logic if it is not in database
    /// </summary>
    private void InsertGoogle()
    {
        string email      = googleScript.Get("email").ToString();
        string googleId   = googleScript.Get("id").ToString();
        string googleName = googleScript.Get("google_name").ToString();
        bool   exist      = studentBL.CheckGoogleExist(googleId);

        if (exist)
        {
            GD.Print("gdsgsd");
            Global.StudentId      = studentBL.GetGoogleStudentId(googleId);
            Global.StudentName    = googleName;
            Global.GoogleLoggedIn = true;

            if (studentBL.CheckGoogleExist(googleId))
            {
                GetTree().ChangeScene("res://Presentation/MainMenu/MainMenu.tscn");
            }
            else
            {
                GetTree().ChangeScene("res://Presentation/CharSelect/CharSelect.tscn");
            }
        }
        else
        {
            GD.Print("dqweeq");
            studentBL.InsertGoogleStudent(googleName, email, googleId);
            Global.StudentId      = studentBL.GetGoogleStudentId(googleId);
            Global.StudentName    = googleName;
            Global.GoogleLoggedIn = true;
            GetTree().ChangeScene("res://Presentation/CharSelect/CharSelect.tscn");
        }
    }
Beispiel #2
0
    /// <summary>
    /// Store Facebook details into database through business logic if it is not in database
    /// </summary>
    private void InsertFb()
    {
        string email  = fbScript.Get("email").ToString();
        string fbId   = fbScript.Get("id").ToString();
        string fbName = fbScript.Get("fb_name").ToString();
        bool   exist  = studentBL.CheckFacebookExist(fbId);

        if (exist)
        {
            Global.StudentId   = studentBL.GetFacebookStudentId(fbId);
            Global.StudentName = fbName;
            Global.FbLoggedIn  = true;

            if (studentBL.CheckFacebookCharExist(fbId))
            {
                GetTree().ChangeScene("res://Presentation/MainMenu/MainMenu.tscn");
            }
            else
            {
                GetTree().ChangeScene("res://Presentation/CharSelect/CharSelect.tscn");
            }
        }
        else
        {
            studentBL.InsertFacebookStudent(fbName, email, fbId);
            Global.StudentId   = studentBL.GetFacebookStudentId(fbId);
            Global.StudentName = fbName;
            Global.FbLoggedIn  = true;
            GetTree().ChangeScene("res://Presentation/CharSelect/CharSelect.tscn");
        }
    }
Beispiel #3
0
    private Ink.Runtime.InkListItem MakeSharpInkListItem(Godot.Object listItem)
    {
        if (!IsInkObjectOfType(listItem, "InkListItem"))
        {
            throw new ArgumentException("Expected a 'Godot.Object' of class 'InkListItem'");
        }

        return(new Ink.Runtime.InkListItem(
                   listItem.Get("origin_name") as string,
                   listItem.Get("item_name") as string
                   ));
    }
 public void _OnCoinBodyEnter(Godot.Object body)
 {
     if (!_taken && ((string)body.Get("name") == "player"))
     {
         ((AnimationPlayer)GetNode("anim")).Play("taken");
         _taken = true;
     }
 }
Beispiel #5
0
    public Ink.Runtime.Path MakeSharpInkPath(Godot.Object path)
    {
        if (!IsInkObjectOfType(path, "InkPath"))
        {
            throw new ArgumentException("Expected a 'Godot.Object' of class 'InkPath'");
        }

        return(new Ink.Runtime.Path((string)path.Get("components_string")));
    }
Beispiel #6
0
 private void Capture()
 {
     if (IsInstanceValid(What))
     {
         foreach (var Property in Properties.Keys)
         {
             Godot.Collections.Array values = (Godot.Collections.Array)Properties[Property];
             values.Add(What.Get(Property));
         }
     }
 }
Beispiel #7
0
    public override bool ParseProperty(Godot.Object @object, int type, string path, int hint, string hintText, int usage)
    {
        if (@object.Get(path) is WaveProperty)
        {
            AddPropertyEditor(path, new WavePropertyEditor());

            return(true);
        }

        return(false);
    }
Beispiel #8
0
    public Ink.Runtime.InkList MakeSharpInkList(Godot.Object list, Ink.Runtime.Story story)
    {
        if (!IsInkObjectOfType(list, "InkList"))
        {
            throw new ArgumentException("Expected a 'Godot.Object' of class 'InkList'");
        }

        var underlyingDictionary =
            (Godot.Collections.Dictionary <Godot.Object, int>)list.Get("_dictionary");
        var originNames = (Godot.Collections.Array <string>)list.Get("origin_names");

        var inkList = new Ink.Runtime.InkList();

        inkList.SetInitialOriginNames(originNames.ToList());

        foreach (string originName in originNames)
        {
            if (story.listDefinitions.TryListGetDefinition(originName, out Ink.Runtime.ListDefinition definition))
            {
                if (!inkList.origins.Contains(definition))
                {
                    inkList.origins.Add(definition);
                }
            }
            else
            {
                throw new Exception(
                          $"InkList origin could not be found in story when reconstructing list: {originName}"
                          );
            }
        }

        foreach (KeyValuePair <Godot.Object, int> kv in underlyingDictionary)
        {
            inkList[MakeSharpInkListItem(kv.Key)] = kv.Value;
        }

        return(inkList);
    }
 public static bool Is(this Object obj, string property) => obj.Get(property) as bool? ?? false;
Beispiel #10
0
 public static T Get <T>(this Godot.Object obj, string property)
 => (T)obj.Get(property);