// 在GameOptions后加上自定义UI // SetGameOptionComponent::ShowGameOption public static void AddAlterOption() { GameObject gameOptionPanel = GameObject.Find("GameOptionPanel"); if (!gameOptionPanel) { FGOAlterLog.print("错误!未能找到GameOptionPanel"); return; } try { GameObject scrollView = gameOptionPanel.transform.FindChild("Option/Scroll View").gameObject; if (!scrollView) { FGOAlterLog.print("错误!未能找到Scroll View"); return; } string componetName = "AlterOption"; GameObject ac = NGUIUtil.FindChild(scrollView, componetName); if (!ac) { ac = new GameObject(componetName); NGUIUtil.SetChild(scrollView, ac); AlterOptionComponet child = ac.AddComponent <AlterOptionComponet>(); child.gameOptionPanel = gameOptionPanel; child.scrollView = scrollView; child.font = gameOptionPanel.GetComponentsInChildren <UILabel>()[0].trueTypeFont; ac.transform.localPosition = new Vector3(0f, -1000f, 0); ac.AddComponent <UIDragScrollView>().scrollView = scrollView.GetComponent <UIScrollView>(); } } catch (Exception e) { FGOAlterLog.print(e.ToString()); } }
public List <BattleCommandComponent> detectOrder(BattlePerformanceCommandCard perf) { List <BattleCommandComponent> result = new List <BattleCommandComponent>(); try { List <BattleCommandComponent> bccl = new List <BattleCommandComponent>(); for (int i = 0; i < perf.p_commandlist.Length; i++) { BattleCommandComponent component = perf.p_commandlist[i].GetComponent <BattleCommandComponent>(); if (!component.isSelect() && 0 <= component.getMarkIndex()) { bccl.Add(component); } } foreach (BattleCommandComponent item in bccl) { //if (BattleCommand.isBLANK(item.getCommandType()) || item.isDontAction) if (BattleCommand.isBLANK(item.getCommandType()) || item.isTreasureDvc() || item.isDontAction) { continue; } if (result.Count < 2) { result.Add(item); } else if (result.Count == 2) { int n1 = result[0].getUniqueID(); int n2 = result[1].getUniqueID(); int n3 = item.getUniqueID(); if (n1 == n2) { if (n1 != n3) { result.Insert(1, item); break; } } else if (n2 == n3) { result.Insert(0, item); break; } else { result.Add(item); break; } } } if (result.Count < 3) { result = bccl.GetRange(0, 3); } } catch (Exception e) { FGOAlterLog.print(e.ToString()); } return(result); }