简体   繁体   中英

Script optimization C#

I'm working on an autosplitter for a program called Livesplit. It's used for speedrunning and by creating autosplitter you can watch memory addresses to tell the app to do an action when the value changes.

It is using C# so it shouldn't be a problem to do some magic.

I'm a complete coding noob with pretty much zero programming experience. I have no idea how to optimize this code, so it first does not look bad and second so the app itself doesn't have problems with it.

Right now, my code looks like this but it is horrifying.

state("GoingDown", "v1")
{
    int Loading : "GoingDown.exe", 0x6874EC;
    string30 LevelFirst : "GoingDown.exe", 0x263E28;
    string30 LevelSecond : "GoingDown.exe", 0x263E37;
    string15 Cutscene : "GoingDown.exe", 0x26B543;
}

state("GoingDown", "v2")
{
    int Loading : "GoingDown.exe", 0x6874EC;
    string30 LevelFirst : "GoingDown.exe", 0x263E40;
    string30 LevelSecond : "GoingDown.exe", 0x263E4F;
    string15 Cutscene : "GoingDown.exe", 0x26B55B;
}

init
{
    if (modules.First().ModuleMemorySize == 0x79A726)
        version = "v1";
    else if (modules.First().ModuleMemorySize == 0x79B000)
        version = "v2";
}

start
{
    //return (old.Level == "M00_CIV_Intro_1" && current.Level == "M01_HOO_Tranes_Hood_1" && current.Loading != 0);
    return (current.LevelFirst.Equals("M01_HOO_Tranes_Hood_1") && current.Loading != 0 && old.Loading == 0 || current.LevelSecond.Equals("M01_HOO_Tranes_Hood_1") && current.Loading != 0 && old.Loading == 00);
}

split
{
    if (old.LevelFirst.Equals("M01_HOO_Tranes_Hood_1", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M01_HOO_Tranes_Hood_1", StringComparison.OrdinalIgnoreCase) || old.LevelSecond.Equals("M01_HOO_Tranes_Hood_1", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M01_HOO_Tranes_Hood_1", StringComparison.OrdinalIgnoreCase))
        return true;

    if (old.LevelSecond.Equals("M01_HOO_Tranes_Hood_1a", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M01_HOO_Tranes_Hood_1a", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("M01_HOO_Tranes_Hood_1a", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M01_HOO_Tranes_Hood_1a", StringComparison.OrdinalIgnoreCase))
        return true;

    if (old.LevelSecond.Equals("M01_HOO_Tranes_Hood_2", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M01_HOO_Tranes_Hood_2", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("M01_HOO_Tranes_Hood_2", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M01_HOO_Tranes_Hood_2", StringComparison.OrdinalIgnoreCase))
        return true;

    if (old.LevelSecond.Equals("M01_HOO_Tranes_Hood_3", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M01_HOO_Tranes_Hood_3", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("M01_HOO_Tranes_Hood_3", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M01_HOO_Tranes_Hood_3", StringComparison.OrdinalIgnoreCase))
        return true;

    if (old.LevelSecond.Equals("M01_HOO_Tranes_Hood_4", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M01_HOO_Tranes_Hood_4", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("M01_HOO_Tranes_Hood_4", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M01_HOO_Tranes_Hood_4", StringComparison.OrdinalIgnoreCase))
        return true;

    if (old.LevelSecond.Equals("M02_HOO_Subway_1a", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M02_HOO_Subway_1a", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("M02_HOO_Subway_1a", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M02_HOO_Subway_1a", StringComparison.OrdinalIgnoreCase))
        return true;

    if (old.LevelSecond.Equals("M02_HOO_Subway_1b", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M02_HOO_Subway_1b", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("M02_HOO_Subway_1b", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M02_HOO_Subway_1b", StringComparison.OrdinalIgnoreCase))
        return true;

    if (old.LevelSecond.Equals("m02_hoo_subway_2", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":m02_hoo_subway_2", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("m02_hoo_subway_2", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":m02_hoo_subway_2", StringComparison.OrdinalIgnoreCase))
        return true;

    if (old.LevelSecond.Equals("m02_hoo_subway_3", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":m02_hoo_subway_3", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("m02_hoo_subway_3", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":m02_hoo_subway_3", StringComparison.OrdinalIgnoreCase))
        return true;

    if (old.LevelSecond.Equals("m03_hoo_whos_got_beef_1", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":m03_hoo_whos_got_beef_1", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("m03_hoo_whos_got_beef_1", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":m03_hoo_whos_got_beef_1", StringComparison.OrdinalIgnoreCase))
        return true;

    if (old.LevelSecond.Equals("m03_hoo_whos_got_beef_2", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":m03_hoo_whos_got_beef_2", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("m03_hoo_whos_got_beef_2", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":m03_hoo_whos_got_beef_2", StringComparison.OrdinalIgnoreCase))
        return true;

    if (old.LevelSecond.Equals("m03_hoo_whos_got_beef_3", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":m03_hoo_whos_got_beef_3", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("m03_hoo_whos_got_beef_3", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":m03_hoo_whos_got_beef_3", StringComparison.OrdinalIgnoreCase))
        return true;

    if (old.LevelSecond.Equals("m03_hoo_whos_got_beef_4", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":m03_hoo_whos_got_beef_4", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("m03_hoo_whos_got_beef_4", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":m03_hoo_whos_got_beef_4", StringComparison.OrdinalIgnoreCase))
        return true;

    //if (old.LevelSecond.Equals("M04_HOO_Subway_layup_0", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M04_HOO_Subway_layup_0", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("M04_HOO_Subway_layup_0", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M04_HOO_Subway_layup_0", StringComparison.OrdinalIgnoreCase))
    //  return true; (CUTSCENE NO NEED TO SPLIT)

    if (old.LevelSecond.Equals("M04_HOO_Subway_layup_1a", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M04_HOO_Subway_layup_1a", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("M04_HOO_Subway_layup_1a", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M04_HOO_Subway_layup_1a", StringComparison.OrdinalIgnoreCase))
        return true;

    if (old.LevelSecond.Equals("M04_HOO_Subway_layup_1b", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M04_HOO_Subway_layup_1b", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("M04_HOO_Subway_layup_1b", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M04_HOO_Subway_layup_1b", StringComparison.OrdinalIgnoreCase))
        return true;

    if (old.LevelSecond.Equals("M04_HOO_Subway_layup_2", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M04_HOO_Subway_layup_2", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("M04_HOO_Subway_layup_2", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M04_HOO_Subway_layup_2", StringComparison.OrdinalIgnoreCase))
        return true;

    if (old.LevelSecond.Equals("M05_HOO_Battle_1", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M05_HOO_Battle_1", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("M05_HOO_Battle_1", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M05_HOO_Battle_1", StringComparison.OrdinalIgnoreCase))
        return true;

    if (old.LevelSecond.Equals("M05_HOO_Battle_3", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M05_HOO_Battle_3", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("M05_HOO_Battle_3", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M05_HOO_Battle_3", StringComparison.OrdinalIgnoreCase))
        return true;

    //if (old.LevelSecond.Equals("M06_IND_Bulletproof_0") && current.LevelSecond.Equals(":M06_IND_Bulletproof_0", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("M06_IND_Bulletproof_0", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M06_IND_Bulletproof_0", StringComparison.OrdinalIgnoreCase))
    //  return true; (CUTSCENE NO NEED TO SPLIT)

    if (old.LevelSecond.Equals("m06_ind_bulletproof_1", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":m06_ind_bulletproof_1", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("m06_ind_bulletproof_1", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":m06_ind_bulletproof_1", StringComparison.OrdinalIgnoreCase))
        return true;

    if (old.LevelSecond.Equals("m06_ind_bulletproof_2", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":m06_ind_bulletproof_2", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("m06_ind_bulletproof_2", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":m06_ind_bulletproof_2", StringComparison.OrdinalIgnoreCase))
        return true;

    if (old.LevelSecond.Equals("M06_IND_Bulletproof_3", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M06_IND_Bulletproof_3", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("M06_IND_Bulletproof_3", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M06_IND_Bulletproof_3", StringComparison.OrdinalIgnoreCase))
        return true;

    //if (old.LevelSecond.Equals("M07_HOO_Blind_Justice_0") && current.LevelSecond.Equals(":M07_HOO_Blind_Justice_0", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("M07_HOO_Blind_Justice_0", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M07_HOO_Blind_Justice_0", StringComparison.OrdinalIgnoreCase))
    //  return true; (CUTSCENE NO NEED TO SPLIT)

    if (old.LevelSecond.Equals("M07_HOO_Blind_Justice_1", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M07_HOO_Blind_Justice_1", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("M07_HOO_Blind_Justice_1", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M07_HOO_Blind_Justice_1", StringComparison.OrdinalIgnoreCase))
        return true;

    if (old.LevelSecond.Equals("M07_HOO_Blind_Justice_2", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M07_HOO_Blind_Justice_2", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("M07_HOO_Blind_Justice_2", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M07_HOO_Blind_Justice_2", StringComparison.OrdinalIgnoreCase))
        return true;

    if (old.LevelSecond.Equals("M07_HOO_Blind_Justice_3", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M07_HOO_Blind_Justice_3", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("M07_HOO_Blind_Justice_3", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M07_HOO_Blind_Justice_3", StringComparison.OrdinalIgnoreCase))
        return true;

    //if (old.LevelSecond.Equals("m08_hoo_remember_alamo_0") && current.LevelSecond.Equals(":m08_hoo_remember_alamo_0", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("m08_hoo_remember_alamo_0", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":m08_hoo_remember_alamo_0", StringComparison.OrdinalIgnoreCase))
    //  return true; (CUTSCENE NO NEED TO SPLIT)

    if (old.LevelSecond.Equals("m08_hoo_remember_alamo_1", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":m08_hoo_remember_alamo_1", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("m08_hoo_remember_alamo_1", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":m08_hoo_remember_alamo_1", StringComparison.OrdinalIgnoreCase))
        return true;

    if (old.LevelSecond.Equals("m08_hoo_remember_alamo_2", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":m08_hoo_remember_alamo_2", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("m08_hoo_remember_alamo_2", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":m08_hoo_remember_alamo_2", StringComparison.OrdinalIgnoreCase))
        return true;

    if (old.LevelSecond.Equals("M08_HOO_Remember_Alamo_3", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M08_HOO_Remember_Alamo_3", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("M08_HOO_Remember_Alamo_3", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M08_HOO_Remember_Alamo_3", StringComparison.OrdinalIgnoreCase))
        return true;

    if (old.LevelSecond.Equals("M09_CIV_Cat_and_Mouse_1a", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M09_CIV_Cat_and_Mouse_1a", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("M09_CIV_Cat_and_Mouse_1a", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M09_CIV_Cat_and_Mouse_1a", StringComparison.OrdinalIgnoreCase))
        return true;

    if (old.LevelSecond.Equals("M09_CIV_Cat_and_Mouse_1b", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M09_CIV_Cat_and_Mouse_1b", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("M09_CIV_Cat_and_Mouse_1b", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M09_CIV_Cat_and_Mouse_1b", StringComparison.OrdinalIgnoreCase))
        return true;

    if (old.LevelSecond.Equals("m09_civ_cat_and_mouse_2", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":m09_civ_cat_and_mouse_2", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("m09_civ_cat_and_mouse_2", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":m09_civ_cat_and_mouse_2", StringComparison.OrdinalIgnoreCase))
        return true;

    if (old.LevelSecond.Equals("m10_civ_bridge_1", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":m10_civ_bridge_1", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("m10_civ_bridge_1", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":m10_civ_bridge_1", StringComparison.OrdinalIgnoreCase))
        return true;

    if (old.LevelSecond.Equals("m10_civ_bridge_2", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":m10_civ_bridge_2", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("m10_civ_bridge_2", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":m10_civ_bridge_2", StringComparison.OrdinalIgnoreCase))
        return true;

    if (old.LevelSecond.Equals("M11_CIV_Blimp_1", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M11_CIV_Blimp_1", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("M11_CIV_Blimp_1", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M11_CIV_Blimp_1", StringComparison.OrdinalIgnoreCase))
        return true;

    // NOT SURE IF IT WORKS
    //if (old.LevelSecond.Equals("M11_CIV_Blimp_2", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M11_CIV_Blimp_2", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("M01_HOO_Tranes_Hood_1", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M01_HOO_Tranes_Hood_1", StringComparison.OrdinalIgnoreCase))
    //  return true; 

    // Final split
    if (current.Cutscene.Contains("M11_010") && current.Cutscene != old.Cutscene)
        return true;
}

isLoading
{
    return (current.Loading == 0);
}

I don't know how to deal with so many if statements. Put it in a dictionary perhaps? But then I have no idea how to make that.

You are comparing old.LevelFirst and old.LevelSecond against lots of static values and doing a case insensitive comparison. Why not, at the top of your split method, take local lowercase copies of these values:

var first = old.LevelFirst.Lower();
var second = old.LevelSecond.Lower();

This makes comparisons easier as follows:

if(first == "..." || first == "..." || first == "..." || ...)
    return true;

Next, I think you have a bug. You have if statements that say:

if(first == "xxxx" && second == "yyyy" || second == "zzz")
    return true;

This statement will return true if second == "zzz" regardless of that value of first as || has a lower precedence than && . You need to put brackets around your second comparisons ie

if(first == "xxxx" && (second == "yyyy" || second == "zzz"))
    return true;

Next, look at using a switch statement for first level instead of if statements (ensuring the values you compare with are lower case:

switch(first)
{
    case "m01_hoo_tranes_hood_1" :
        return 
            (second == ":m01_hoo_tranes_hood_1") ||
            (second == "m01_hoo_tranes_hood_1") ||
            (second == ":m01_hoo_tranes_hood_1");

    case "m01_hoo_tranes_hood_1" :
       .....
}

These is a logic change here - I am assuming that if first is m01_hoo_tranes_hood_1 but not any of the second values, then the logic will fall right through to the end and return false. Your if logic could allow for the same first value to match later on and have different logic but this can be incorporated into the above case statement anyway.

Finally, look at the variable values. Are the colon : prefixes relevant or is it a case that "they may or may not be there so I need to check for both"? If so, back on those two var first = / var = second = statements, and remove the : prefix which should reduce the comparisons:

if(first.StartsWith(":"))
    first = first.Substring(1); // Remove first character

Now you don't need to include the colon prefix in all your compares.

Thanks, Chris

From what I could tell you could cut a lot of code by doing something like

 Func<string,string,bool>  eq = (a,b) => a.Equals(b, StringComparison.OrdinalIgnoreCase);

    var levels = new string[] 
    {
       "M01_HOO_Tranes_Hood_1",
       "M01_HOO_Tranes_Hood_1a",
       "M01_HOO_Tranes_Hood_2",
       "M01_HOO_Tranes_Hood_3",
       "M01_HOO_Tranes_Hood_4",
       "M02_HOO_Subway_1a",
       "M02_HOO_Subway_1b",
       "m02_hoo_subway_2",
       "m02_hoo_subway_3",
       "m03_hoo_whos_got_beef_1",
       "m03_hoo_whos_got_beef_2",
       "m03_hoo_whos_got_beef_3",
       "m03_hoo_whos_got_beef_4",
       "M04_HOO_Subway_layup_1a",
       "M04_HOO_Subway_layup_1b",
       "M04_HOO_Subway_layup_2",
       "M05_HOO_Battle_1",
       "M05_HOO_Battle_3",
       "m06_ind_bulletproof_1",
       "m06_ind_bulletproof_2",
       "M06_IND_Bulletproof_3",
       "M07_HOO_Blind_Justice_1",
       "M07_HOO_Blind_Justice_2",
       "M07_HOO_Blind_Justice_3",
       "m08_hoo_remember_alamo_1",
       "m08_hoo_remember_alamo_2",
       "M08_HOO_Remember_Alamo_3",
       "M09_CIV_Cat_and_Mouse_1a",
       "M09_CIV_Cat_and_Mouse_1b",
       "m09_civ_cat_and_mouse_2",
       "m10_civ_bridge_1",
       "m10_civ_bridge_2",
       "M11_CIV_Blimp_1"
    };

    if(levels.Any((level) => eq(old.LevelFirst,level) &&  eq(current.LevelSecond, ":" + level) || eq(old.LevelSecond,level) && eq(current.LevelFirst, ":" + level)))
       return true;

    // NOT SURE IF IT WORKS
    //if (old.LevelSecond.Equals("M11_CIV_Blimp_2", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M11_CIV_Blimp_2", StringComparison.OrdinalIgnoreCase) || old.LevelFirst.Equals("M01_HOO_Tranes_Hood_1", StringComparison.OrdinalIgnoreCase) && current.LevelSecond.Equals(":M01_HOO_Tranes_Hood_1", StringComparison.OrdinalIgnoreCase))
    //  return true; 

    // Final split
    if (current.Cutscene.Contains("M11_010") && current.Cutscene != old.Cutscene)
        return true;

But is this really more readable I don't know.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM