فهرست منبع

Merge pull request #38640 from neikeq/csharpscript-inherits-script

Implement CSharpScript::inherits_script
Ignacio Roldán Etcheverry 5 سال پیش
والد
کامیت
77a9334c58
1فایلهای تغییر یافته به همراه9 افزوده شده و 4 حذف شده
  1. 9 4
      modules/mono/csharp_script.cpp

+ 9 - 4
modules/mono/csharp_script.cpp

@@ -3542,10 +3542,15 @@ bool CSharpScript::inherits_script(const Ref<Script> &p_script) const {
 		return false;
 	}
 
-#ifndef _MSC_VER
-#warning TODO: Implement CSharpScript::inherits_script and other relevant changes after GH-38063.
-#endif
-	return false;
+	if (script_class == nullptr || cs->script_class == nullptr) {
+		return false;
+	}
+
+	if (script_class == cs->script_class) {
+		return true;
+	}
+
+	return cs->script_class->is_assignable_from(script_class);
 }
 
 Ref<Script> CSharpScript::get_base_script() const {