コード例 #1
0
    bool AEEditorPrefs::CreateDefaultPreferences(String& path, JSONValue& prefs)
    {
        // Note there is some duplication here with the editor's
        // TypeScript preference code, this is due to the preferences for
        // the editor window needing to be available at window creation time
        // It could be better to split this all out to a native, scriptable
        // preferences object

        ATOMIC_LOGINFOF("Creating default Atomic Editor preferences: %s", path.CString());

        SharedPtr<JSONFile> jsonFile(new JSONFile(context_));

        JSONValue& root = jsonFile->GetRoot();

        root.Clear();
        root["recentProjects"] = JSONArray();

        JSONValue editorWindow;
        GetDefaultWindowPreferences(editorWindow, true);

        JSONValue playerWindow;
        GetDefaultWindowPreferences(playerWindow, false);

        root["editorWindow"] = editorWindow;
        root["playerWindow"] = playerWindow;

        prefs = root;

        SavePreferences(prefs);

        return true;
    }
コード例 #2
0
int LicenseSystem::ParseResponse(const String& response, LicenseParse& parse)
{

    ATOMIC_LOGINFOF("%s", response.CString());

    if (response.StartsWith("AC_ACTIVATIONSEXCEEDED"))
    {
        return 1;
    }

    if (response.StartsWith("AC_IDNOTACTIVATED"))
    {
        return 4;
    }

    if (response.StartsWith("AC_FAILED"))
    {
        return 2;
    }

    if (!response.StartsWith("WINDOWS"))
    {
        ATOMIC_LOGERRORF("Error Parsing Server Response %s", response.CString());
        return 3;
    }

    String codes = response;
    codes.Replace("\n", "");
    codes.Replace("\r", "");

    Vector<String> cvector = codes.Split(' ');

    for (unsigned i = 0; i < cvector.Size(); i++)
    {
        Vector<String> feature = cvector[i].Split('=');
        if (feature.Size() != 2)
            continue;

        if (feature[0] == "WINDOWS")
            parse.licenseWindows_ = !feature[1].StartsWith("0");
        else if (feature[0] == "MAC")
            parse.licenseMac_ = !feature[1].StartsWith("0");
        else if (feature[0] == "ANDROID")
            parse.licenseAndroid_ = !feature[1].StartsWith("0");
        else if (feature[0] == "IOS")
            parse.licenseIOS_ = !feature[1].StartsWith("0");
        else if (feature[0] == "HTML5")
            parse.licenseHTML5_ = !feature[1].StartsWith("0");
        else if (feature[0] == "THREED")
            parse.licenseModule3D_ = !feature[1].StartsWith("0");

    }

    return 0;

}
コード例 #3
0
void ToolEnvironment::Dump()
{
    ATOMIC_LOGINFOF("Root Source Dir: %s", rootSourceDir_.CString());
    ATOMIC_LOGINFOF("Root Build Dir: %s", rootBuildDir_.CString());

    ATOMIC_LOGINFOF("Core Resource Dir: %s", resourceCoreDataDir_.CString());
    ATOMIC_LOGINFOF("Player Resource Dir: %s", resourcePlayerDataDir_.CString());
    ATOMIC_LOGINFOF("Editor Resource Dir: %s", resourceEditorDataDir_.CString());

    ATOMIC_LOGINFOF("Editor Binary: %s", editorBinary_.CString());
    ATOMIC_LOGINFOF("Player Binary: %s", playerBinary_.CString());
    ATOMIC_LOGINFOF("Tool Binary: %s", toolBinary_.CString());


    ATOMIC_LOGINFOF("Tool Data Dir: %s", toolDataDir_.CString());

    ATOMIC_LOGINFOF("Deployment Data Dir: %s", deploymentDataDir_.CString());

}
コード例 #4
0
ファイル: BindCmd.cpp プロジェクト: Type1J/AtomicGameEngine
void BindCmd::Run()
{
    SharedPtr<JSBind> jsbind(new JSBind(context_));

    context_->RegisterSubsystem(jsbind);

    ATOMIC_LOGINFOF("Loading Package");
    jsbind->LoadPackage(sourceRootFolder_, packageFolder_);

    jsbind->GenerateJavaScriptBindings();

    jsbind->GenerateCSharpBindings();

    Finished();

}
コード例 #5
0
void LicenseSystem::RequestServerVerification(const String& key)
{
    if (serverVerification_.NotNull())
    {
        ATOMIC_LOGERROR("LicenseSystem::RequestServerLicense - request already exists");
        return;
    }

    FileSystem* fileSystem = GetSubsystem<FileSystem>();

    if (fileSystem->FileExists(licenseCachePath_))
    {
        Time* time = GetSubsystem<Time>();
        unsigned currentTime = time->GetTimeSinceEpoch();
        unsigned fileTime = fileSystem->GetLastModifiedTime(licenseCachePath_);
        unsigned deltaMinutes = (currentTime - fileTime)/60;
        if (deltaMinutes < 1)
        {
            ATOMIC_LOGINFOF("%u minutes, using cached license", deltaMinutes);
            SendEvent(E_LICENSE_SUCCESS);
            return;
        }
    }

    ATOMIC_LOGINFO("LicenseSystem::RequestServerLicense - requesting verification");

    key_ = key;
    CurlManager* cm = GetSubsystem<CurlManager>();
    String post;
    String id = GenerateMachineID();
    post.AppendWithFormat("key=%s&id=%s", key.CString(), id.CString());

    serverVerification_ = cm->MakeRequest("https://store.atomicgameengine.com/licenses/license_verify.php", post);

    SubscribeToEvent(serverVerification_, E_CURLCOMPLETE, ATOMIC_HANDLER(LicenseSystem, HandleVerification));
}
コード例 #6
0
void BuildCmd::Run()
{
    ATOMIC_LOGINFOF("Building project for: %s", buildPlatform_.CString());

    ToolSystem* tsystem = GetSubsystem<ToolSystem>();
    Project* project = tsystem->GetProject();

    Platform* platform = NULL;

    platform = tsystem->GetPlatformByName(buildPlatform_);

    if (!platform)
    {
        Error(ToString("Unknown build platform: %s", buildPlatform_.CString()));
        return;
    }

    // create the build
    BuildBase* buildBase = platform->NewBuild(project);
    if (!assetsBuildTag_.Empty())
    {
        buildBase->SetAssetBuildTag(assetsBuildTag_);
    }
    buildBase->SetAutoLog(autoLog_);

    // add it to the build system
    BuildSystem* buildSystem = GetSubsystem<BuildSystem>();

    buildSystem->QueueBuild(buildBase);

    SubscribeToEvent(E_BUILDCOMPLETE, ATOMIC_HANDLER(BuildCmd, HandleBuildComplete));

    // TODO: parallel/serial builds
    buildSystem->StartNextBuild();

}
コード例 #7
0
void CSClassWriter::GenerateManagedSource(String& sourceOut)
{
    String source = "";

    if (klass_->IsNumberArray())
        return;

    Indent();

    source += "\n";
    String line;

    if (klass_->GetDocString().Length())
    {
        // monodocer -assembly:NETCore.dll -path:en -pretty
        // mdoc export-html -o htmldocs en
        source += IndentLine("/// <summary>\n");
        if (klass_->GetDocString().Contains('\n'))
            source += IndentLine("/* " + klass_->GetDocString() + "*/\n");
        else
            source += IndentLine("/// " + klass_->GetDocString() + "\n");

        source += IndentLine("/// </summary>\n");
    }

    if (klass_->GetBaseClass())
    {

        String baseString = klass_->GetBaseClass()->GetName();

        const PODVector<JSBClass*>& interfaces = klass_->GetInterfaces();

        if (interfaces.Size())
        {
            StringVector baseStrings;
            baseStrings.Push(baseString);
            for (unsigned i = 0; i < interfaces.Size(); i++)
            {
                baseStrings.Push(interfaces.At(i)->GetName());
            }

            baseString = String::Joined(baseStrings, ",");
        }

        line = ToString("public partial class %s%s : %s\n", klass_->GetName().CString(), klass_->IsGeneric() ? "<T>" : "", baseString.CString());
    }
    else
    {
        String classString = "class";

        if (klass_->IsInterface())
            classString = "interface";

        line = ToString("public partial %s %s%s\n", classString.CString(), klass_->GetName().CString(), klass_->IsGeneric() ? "<T>" : "");
    }


    source += IndentLine(line);
    source += IndentLine("{\n");

    Indent();

    WriteManagedProperties(source);

    JSBPackage* package = klass_->GetPackage();

    // CoreCLR has pinvoke security demand code commented out, so we do not (currently) need this optimization:
    // https://github.com/dotnet/coreclr/issues/1605
    // line = "[SuppressUnmanagedCodeSecurity]\n";
    // source += IndentLine(line);

    if (!klass_->IsInterface())
    {
        line = "[DllImport (Constants.LIBNAME, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]\n";
        source += IndentLine(line);
        line = ToString("public static extern IntPtr csb_%s_%s_GetClassIDStatic();\n", package->GetName().CString(), klass_->GetName().CString());
        source += IndentLine(line);
        source += "\n";
    }

    Dedent();

    // managed functions

    CSFunctionWriter::SetWroteConstructor(false);

    for (unsigned i = 0; i < klass_->functions_.Size(); i++)
    {
        JSBFunction* function = klass_->functions_.At(i);

        if (function->Skip())
            continue;

        if (klass_->IsInterface() && function->IsConstructor())
            continue;

        if (function->IsDestructor())
            continue;

        if (CSTypeHelper::OmitFunction(function))
            continue;

        CSFunctionWriter fwriter(function);
        fwriter.GenerateManagedSource(source);

    }

    // There are some constructors being skipped (like HTTPRequest as it uses a vector of strings in args)
    // Make sure we have at least a IntPtr version
    if (!klass_->IsInterface() && !CSFunctionWriter::GetWroteConstructor() && klass_->GetName() != "RefCounted")
    {
        ATOMIC_LOGINFOF("WARNING: %s class didn't write a constructor, filling in generated native constructor", klass_->GetName().CString());

        line = ToString("public %s (IntPtr native) : base (native)\n", klass_->GetName().CString());
        source += IndentLine(line);
        source += IndentLine("{\n");
        source += IndentLine("}\n\n");
    }

    CSFunctionWriter::SetWroteConstructor(false);

    source += IndentLine("}\n");

    Dedent();

    sourceOut += source;
}
コード例 #8
0
// Reroute all messages from the ik library to the Atomic log
static void HandleIKLog(const char* msg)
{
    ATOMIC_LOGINFOF("[IK] %s", msg);
}